Get and Set Method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sl1ver
    New Member
    • Mar 2009
    • 196

    Get and Set Method

    i've got 2 forms, login form and main form. the user types his name in the textbox. i wan to store that name in a string variable and then use it to set a label in the main form? how will i get by doing this, help is much appreciated
  • LitaOsiris
    New Member
    • Jan 2008
    • 16

    #2
    On the click event to go into the main form have a string to get the name out of the textbox on the login form. When you call the main form, pass in the string with the name.

    string username = txtUsername.Tex t;
    FormMain frmMain = new FormMain(userna me);


    public FormMain(string nameIn)
    {
    lblShowName.Tex t = nameIn;
    }

    Comment

    • Sl1ver
      New Member
      • Mar 2009
      • 196

      #3
      shot man, it works. got any advice for putting variables in get and set methods or maybe properties?

      Comment

      Working...