OOP Confused

  • Thread starter Thread starter Thomas.Swaney
  • Start date Start date
T

Thomas.Swaney

I have developed many applications in VB and eVB. I am currently
working on developing an application with the .net compact framework
2.0 in Visual Studio 2005.

In VB or eVB you could access another forms controls as shown below:

'From frmMain Click event

frmGetPrimary.grdPrimary.DataSource = dtChildUPN
From some of the information that I have read you have to create a form
that will share it's properties before you can use the properties. This
is all very confusing for me. My problem is that the frmGetPrimary form
hasn't been called as of yet before the frmMain click event has been
fired. Can someone please tell me how to set the DataSource for a grid
in Form2 if Form1 is the form with the Click Event. Please keep it
VB/eVB oriented so I can understand. Thanks.
 
Hello,
In VB2005 you can indeed access the other form the very same way that you can access it in VB. This capability was missing in VS2003 and you would have to access the form properties and method through an object variable.

But it VB2005 it should work... Are you facing any problems doing that?

Cheers!
Cyril Gupta
 
Thomas,

In VBNet 2005 is introduced a non OOP piece special for not yet converted
VB6 developers who did not want to use OOP in VBNet but would use the
classic VB6 way, so you can use that, you find it in the "my" class.

If you want it OOP than you can declare your datagrid as Friend or Public in
your form2 and place your form public in your frm1 (outside a method)

Public frm2 as new form2

Now you can use the datagrid of frm2 everywhere in frm1

frm2.MyDatagrid

I hope this gives an idea,

Cor
 
Back
Top