Form

R

Rado

Hello.
I have Two forms.
In Form1 I have 2 textboxes (textbox1, textbox2).
And one Button.
When I click to button form2 Show
****
dim frm as new form2
frm.showdialog
*****
That's OK.
And From Form2 A want set Text To textbox2 and textbox2.

I try write
dim frm as new form1
frm.txttbox2.text ="name"
....
....
But Nothing happend.


And when I write dim frm as form1, Complier give error. "Object reference
not set to an instance of an object."

How Can I do it?
Thanks for answers
 
C

Cor Ligthert

Rado,

This is bad programming in my opinion so try to do it in future in another
way.

However I sand this message today to someone else so why not to you.

In form2
Public frm1 as form

And in form1
Form1.vb
private frm2 as Form2
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
frm2 = New Form2
frm2.Frm1 = me
frm2.Show()
End Sub


You can than even communicatie between the two (when it are of course
friend/public members)
In form1 is form2 than frm2
In form2 is form1 than frm1

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top