pass values between forms c#
  • how to pass values between two forms in c#
  • 5 Comments sorted by
  • Will u please explain sunario what should you want?
    do best will hope best
  • i want to pass ID from one form1 to another form2.
  • declare a public property from the source:

    public string UserName{get;set;}

    Set value within the source and call it from the destination.
  • Vote Up0Vote Down farazfaraz
    10.00 Karma Accepted Answer
    you can use static variable get complete code from this link
  • Vote Up0Vote Down niit_mm85niit_mm85
    45.50 Karma Accepted Answer
    You can use this piece of code to pass ID from Form1 to Form2.

    In Form1:
    public static string passIDtext = "";

     private void textBox1_TextChanged(object sender, EventArgs e)
                  passIDtext = textID.Text;

    In Form2
     private void Form2_Load(object sender, EventArgs e)
                textID.Text = Form1.passIDtext ;

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook


Popular Posts of the Week