Change data in th midst of Forms

R

Rado

Hello.
I've got one problem.
I have to forms> Form1 and Form2.
Form1 and form2 are loaded, And I want change some data in Form1 from Form2.
I tryed to write this>>
Dim frm as new form1
frm.textbox1.text="Peter", but this is probably bad, because program show me
error.

How can I do it?
Thanks for answers.
 
H

Herfried K. Wagner [MVP]

* "Rado said:
Hello.
I've got one problem.
I have to forms> Form1 and Form2.
Form1 and form2 are loaded, And I want change some data in Form1 from Form2.
I tryed to write this>>
Dim frm as new form1
frm.textbox1.text="Peter", but this is probably bad, because program show me

This will create a new instance of 'Form1' and won't use the original
instance. Instead, you will have to make a reference to the
form's instance available to the other form, for example by passing it
in a parameter of a method or by setting a property.
 
C

Cor Ligthert

Hi Rado,

You did of course understand all Herfried said
However when not, in code it is.

dim frm as new form2
frm.myvalue = "Peter"
frm.show

As public value in beneath the designer generated code in form2
public myvalue as string
And in the loadevent from that form2
me.textbox1.text = myvalue

I hope this helps?

Cor
 
R

Rado

Hello Herfried K.

Thaks for answer, but I don't exactly understand what you wrote.
Can you write me some example?
Thank you very much for your answer.
 

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

Similar Threads


Top