I have one text box button, say by name txtmessage in one form (MainForm )and what i have to do is on click of OK buttton in the other form (SubForm) I have to write some message in that txtmessage text box....please help me to do this
How to use controls of one class in another class in c#.net
Collapse
X
-
-
hi, if you have windows applicationt then you can do that as following:
lets suppose on form1 you have a button and on form2 has textbox
you can make textbox public on form2 and then in form1 create instance of form2 and set the value of textbox
in button click event write the following..
Form2 f=new Form2()
Form2.TextBox1. Text="hello"
this.close()
further you can create a public property on form2 and set the value from any other form
Code:public string UserID { set { this.textBox1.Text = value ; } get { return UserID ; } }
MunawarComment
Comment