|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Working between formsa component which I want to update from Screen2. However, if I simply call the component from Screen2 it can't find it. If I create a new instance of Screen1 in Screen2 and then call the component using a reference, this works, but I end up with 2 Screen1's and the original screen is not updated since I am only updating the new instance of Screen1. How do I make the component available to Screen2? I changed the components access property to Public but this didn't seem to make any difference. Or can I stop the initial form from loading? I tried to add a Main module: Module Startup Public scr1 As Screen1 Public scr2 As Screen2 Sub Main() scr1 = New Screen1 scr2 = New Screen2 scr1.Activate() scr1.Show() End Sub End Module But this just partially loads the form then bombs out with no errors or anything. Cheers -- Jeffrey Spoon Jeffrey Spoon wrote:
Show quoteHide quote > You need to pass Screen2 the instance of Screen1 so that S2 knows where > > > Hello I have two forms which have components on them. On Screen1 I have > a component which I want to update from Screen2. However, if I simply > call the component from Screen2 it can't find it. If I create a new > instance of Screen1 in Screen2 and then call the component using a > reference, this works, but I end up with 2 Screen1's and the original > screen is not updated since I am only updating the new instance of > Screen1. How do I make the component available to Screen2? I changed the > components access property to Public but this didn't seem to make any > difference. Or can I stop the initial form from loading? > > I tried to add a Main module: > > Module Startup > Public scr1 As Screen1 > Public scr2 As Screen2 > > Sub Main() > scr1 = New Screen1 > scr2 = New Screen2 > scr1.Activate() > scr1.Show() > End Sub > End Module > > But this just partially loads the form then bombs out with no errors or > anything. > > Cheers > > > > S1 is. Example: Class S2 Dim ptrS1 as S1 Sub New(Value as S1) ptrS1 = Value End Sub End Class Sub Main() scr1 = New Screen1 scr2 = New Screen2(scr1) End Sub Now you will be able to act on S1 in S2. Chris In message <e8Hx6mEQFHA.***@TK2MSFTNGP12.phx.gbl>, Chris <no@spam.com>
writes Show quoteHide quote > Thanks Chris. I still can't seem to load Screen1 properly though from >You need to pass Screen2 the instance of Screen1 so that S2 knows where >S1 is. > >Example: > >Class S2 > Dim ptrS1 as S1 > Sub New(Value as S1) > ptrS1 = Value > End Sub >End Class > >Sub Main() > scr1 = New Screen1 > scr2 = New Screen2(scr1) >End Sub > >Now you will be able to act on S1 in S2. > >Chris Main. The window loads and vanishes. Originally when I was loading it straight from Screen1 it worked ok, using a form load event handler. -- Jeffrey Spoon Jeffrey Spoon wrote:
Show quoteHide quote > In message <e8Hx6mEQFHA.***@TK2MSFTNGP12.phx.gbl>, Chris <no@spam.com> This is because all your threads have exited. You don't have any > writes > >> >> You need to pass Screen2 the instance of Screen1 so that S2 knows >> where S1 is. >> >> Example: >> >> Class S2 >> Dim ptrS1 as S1 >> Sub New(Value as S1) >> ptrS1 = Value >> End Sub >> End Class >> >> Sub Main() >> scr1 = New Screen1 >> scr2 = New Screen2(scr1) >> End Sub >> >> Now you will be able to act on S1 in S2. >> >> Chris > > > Thanks Chris. I still can't seem to load Screen1 properly though from > Main. The window loads and vanishes. Originally when I was loading it > straight from Screen1 it worked ok, using a form load event handler. > > message loops setup. That is just a fancy way of saying you need to use ShowDialog (a blocking call so your thread won't exit until the form is closed) instead of Show. Chris In message <Ode9skFQFHA.1***@tk2msftngp13.phx.gbl>, Chris <no@spam.com>
writes >> Excellent thanks. That worked, although Screen2's components are > > >This is because all your threads have exited. You don't have any >message loops setup. That is just a fancy way of saying you need to >use ShowDialog (a blocking call so your thread won't exit until the >form is closed) instead of Show. > >Chris complaining of a null reference. I would've thought that it would use the reference in Main? Anyway I'll work on it. Cheers. -- Jeffrey Spoon In message <J+m2ehC9JXXCF***@nowhere.nnn>, Jeffrey Spoon
<JeffreySp***@hotmail.com> writes Show quoteHide quote >In message <Ode9skFQFHA.1***@tk2msftngp13.phx.gbl>, Chris <no@spam.com> Finally I have it working. Of course it was something stupidly simple >writes >>> >> >> >>This is because all your threads have exited. You don't have any >>message loops setup. That is just a fancy way of saying you need to >>use ShowDialog (a blocking call so your thread won't exit until the >>form is closed) instead of Show. >> >>Chris > >Excellent thanks. That worked, although Screen2's components are >complaining of a null reference. I would've thought that it would use >the reference in Main? Anyway I'll work on it. Cheers. > > (didn't reference the module properly - doh!) Cheers Chris. -- Jeffrey Spoon
How are you handling EUL agreement?
Panel-height greater Int16.MaxValue? Regex. Split or Split Is there anyway to tell when code is executing at compile time? How to pass class as parameter? Category does not exist? self executable Retrieving Child Rows Exception handling problem variable assignment |
|||||||||||||||||||||||