how to control a control located in another form in .net like we did in vb 6: form1.textbox1.text=" " thanks for help! :)
Printable View
how to control a control located in another form in .net like we did in vb 6: form1.textbox1.text=" " thanks for help! :)
anyone HELP?
Remember Vb.Net everthing is an object.
So you have to call the form and the textbox.
Code:Module CodeModule
Public frmMainOne As System.Windows.Forms.Form
End Module
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
frmMainOne = Me
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Gets the caption from the first form
txtBox6.Text = frmMainOne.Text
End Sub
http://www.vbforums.com/showthread.p...hreadid=233092
change
Public frmMainOne As System.Windows.Forms.Form
to
Public frmMainOne As System.Windows.Forms.text
for textboxes or change it as you need it !
or you can use this easy way
VB Code:
dim frm2 as new form2 'second form the control in 'this will write some text from your current window to the other frm2.Textbox1.text="blah"
both of them don't work! :(
Quote:
Originally posted by Pirate
or you can use this easy way
VB Code:
dim frm2 as new form2 'second form the control in 'this will write some text from your current window to the other frm2.Textbox1.text="blah"
this one actually create a new form but not the original form!
Is this what you mean ??