|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Simple questionI open Form2 from Form1 by doing this: dim frm as Form2 frm=new Form2 frm.ShowDialog I need to change the Button1.Text on the Form1 from Form2. I'm trying : dim frmCaller as Form1 frmCaller=new Form1 frmCaller.Button1.Text="Something" The text of Button1 on Form1 doesn't change I suspect that I do not connect to the existing Form1, I just create a new instance of the Form1 and change Button1.Text in it. Because I see that in debug mode the text property is changed, but it's not on the screen. In VB6 assigning Caption of the Button from another form was pretty simple - Form1.Caption = "Something". That's it. How is it done in VB2005? Thank you Al Al,
Form2 needs a reference to Form1. One option is to create a property on Form2 similar to this: Public frmCaller as Form1 Then, on Form1, supply the reference before showing Form2: dim frm as Form2 frm=new Form2 frm.frmCaller = Me frm.ShowDialog Now Form2 can click a button on Form1: frmCaller.Button1.Text="Something" Kerry Moorman Show quoteHide quote "Al" wrote: > I have 2 forms - Form1 and Form2 > > I open Form2 from Form1 by doing this: > > dim frm as Form2 > frm=new Form2 > frm.ShowDialog > > I need to change the Button1.Text on the Form1 from Form2. > I'm trying : > dim frmCaller as Form1 > frmCaller=new Form1 > frmCaller.Button1.Text="Something" > > The text of Button1 on Form1 doesn't change > I suspect that I do not connect to the existing Form1, I just create a new > instance of the Form1 and change Button1.Text in it. Because I see that in > debug mode the text property is changed, but it's not on the screen. > > In VB6 assigning Caption of the Button from another form was pretty simple - > Form1.Caption = "Something". That's it. > How is it done in VB2005? > > Thank you > Al > > > > Thanks a lot, Kerry
It is what I was looking for. Al Show quoteHide quote "Kerry Moorman" <KerryMoor***@discussions.microsoft.com> wrote in message news:06E6F796-F083-4E27-937F-50F639076295@microsoft.com... > Al, > > Form2 needs a reference to Form1. > > One option is to create a property on Form2 similar to this: > > Public frmCaller as Form1 > > Then, on Form1, supply the reference before showing Form2: > > dim frm as Form2 > frm=new Form2 > frm.frmCaller = Me > frm.ShowDialog > > Now Form2 can click a button on Form1: > > frmCaller.Button1.Text="Something" > > Kerry Moorman > > "Al" wrote: > >> I have 2 forms - Form1 and Form2 >> >> I open Form2 from Form1 by doing this: >> >> dim frm as Form2 >> frm=new Form2 >> frm.ShowDialog >> >> I need to change the Button1.Text on the Form1 from Form2. >> I'm trying : >> dim frmCaller as Form1 >> frmCaller=new Form1 >> frmCaller.Button1.Text="Something" >> >> The text of Button1 on Form1 doesn't change >> I suspect that I do not connect to the existing Form1, I just create a >> new >> instance of the Form1 and change Button1.Text in it. Because I see that >> in >> debug mode the text property is changed, but it's not on the screen. >> >> In VB6 assigning Caption of the Button from another form was pretty >> simple - >> Form1.Caption = "Something". That's it. >> How is it done in VB2005? >> >> Thank you >> Al >> >> >> >>
Total VB.Net newbie - Directory.Exists question
Saving Jpeg/Exif info Please Help. How do I extend My.Resources System.Timers.Timer.Elapsed event not firing How to simplifying boolean algebra expression? How do I find and use a Window Handle? "Looksalike" algorithm How to simplifying boolean algebra expression? Error connectiong to database Edit and Continue doesn't work |
|||||||||||||||||||||||