c sharp textbox problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kinannawaz
    New Member
    • Dec 2007
    • 20

    c sharp textbox problem

    i am not able to store the value retrived from the textbox to string type variable
    the code is

    it runs but show me nothing.....

    public string getFirstname_te xtBox()
    {
    string txt = Firstname_textB ox.Text.ToStrin g();
    MessageBox.Show (txt);
    return txt;
    }

    HOW CAN I WRITE GET AND SET METHOD FOR A TEXTBOX?
    eg

    public string Firstname_textB ox
    {
    get{return Firstname_textB ox.Text.ToStrin g();}
    set{Firstname_t extBox.Text=val ue;}
    }

    i have done it but doesnot return the string

    HELP?
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    The .Text property is already a string, using .ToString() is not needed.
    Did you make sure to put something IN your textbox, before calling that function?

    Comment

    Working...