Need help with C#

Discussion in 'Software' started by Demon4231, Dec 4, 2007.

  1. Demon4231

    Demon4231 Private E-2

    I need help with C# in the Windows Application. I have made a program that holds my keys for my games and I would like to know how to press a button and make it insert the numbers/letters into the appropriate boxes for each game. What would the code look like? I am not the best at C#, I just started taking it at school so I'm kinda a beginner.
     
  2. Wookie

    Wookie Sergeant Major

    Here is a bit of an example, you create a form then create some text and button objects

    this.button1 = new System.Windows.Forms.Button();
    this.textBox1 = new System.Windows.Forms.TextBox();

    The button1 is going to need an event handler to know what method to kick off when it is clicked

    this.button1.Click += new System.EventHandler(this.button1_Click);

    So inside button1_Click

    private void button1_Click(object sender, EventArgs e)
    {
    textBox1.Text = "test";
    }

    This set the textBox1 objects text to "test" when the button is clicked

    If your coding all of this then what I said will make a bit of sense, you could also just create a new form with the wizard, drag a textbox and button on it then double click the button to have the event handler and button click methods created automatically
     
  3. Demon4231

    Demon4231 Private E-2

    I know how to do that, I meant when installing the game how do I press a button and make it go into the boxes so I don't have to type it in when installing. Like some keygens have a button like that, and it just enters in the numbers/letters for you.
     
  4. Wookie

    Wookie Sergeant Major

  5. Demon4231

    Demon4231 Private E-2

    Ok, thank for your help.
     
  6. Demon4231

    Demon4231 Private E-2

    Can't Delete posts?
     
    Last edited: Dec 6, 2007
  7. LI_Geek_95

    LI_Geek_95 Post-and-Run Geek

    I don't think you can...
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds