Home > DeveloperSection > Forums > Returning a value from textbox in a class
Chintoo Semi

Total Post:135

Posted on    December-18-2014 10:05 PM

 .NET C#  ASP.Net 

 2 Reply(s)
 781  View(s)
Rate this:

I have a text box in my form. I have a class TicketUser where i have accessors set to return a a value in my label. Im trying to get the value from the text box inside the label. I'm trying to get firstName to return a value of txtfirstName.Text from my form. Can someone please guide me in the right direction please. Im pretty new to asp.net


public class TicketUser


    public string firstName;

    public string lastName;

    public string username;

    TicketForm form = new TicketForm();


    //property accessors

  public string CreateAccountMessage




            return "Congratulations" + firstName + "Your account has been created. Your username is" + username;




            CreateAccountMessage = value;


    //CreateAccount method

    public string CreateAccount()


        return CreateAccountMessage;


john rob

Total Post:108

Posted on    December-19-2014 1:40 AM

I hope i got you correct because you need to some details about what you are trying to do and what are the results. Make and Object of TicketUser in the code behind file of the form and set


t = new TicketUser();




Pravesh Singh

Total Post:412

Posted on    December-19-2014 6:39 AM

Change this:


public string firstName = "";

public string lastName = "";

public string username = "";

Don't want to miss updates? Please click the below button!

Follow MindStick