.net - Using multiple instances of a specific UserControl within an application to reference itself -


i got class in visual basic:

class dumbo     inherits system.windows.forms.usercontrol      me.dataset = new dataset     me.bs = new system.windows.forms.bindingsource  sub new()     me.bs.datamember = "table1"     me.datasource = me.dataset end sub       'other commands here doing interactions sql database  end class 

using tabcontrol on main window, have user control working fine on first tabpage operator can enter in data, or view previous records in database, need add panel on tab control

so doing this:

dim dumbo1 = new dumbo      'usercontrol on first tab dim dumbo2 = new dumbo      'usercontrol on second tab 

i know writing dumbo2 = dumbo1 doesn't work @ all. try , set dataset , bindingsource each other, isn't there simpler way of referencing class instead?

edit: i'm drawing experience in c++ use address of class (&foo) if wanted reference same class.

so if have this:

classfoo foo = new classfoo(); classfoo *foo1 = &foo; 

therefore can use same class fields, properties, , methods read/write database. data has same datarow on both tabpages

i hoping there cheap , dirty trick in vb.net can reference same usercontrol, when user switches tabpages, same data, able read same data, and/or write , commit changes , reflect modifications on other page. or similar byref (or ref in c#) reference class only.

i hope clears bit. :-)

your tabcontrol control contain new dumbo variable. each tab reference variable tabcontrol.

inside tabpage, have

ctype(me.parent, customtabcontrol).dumbo 

an other option when tabcontrol initialize each tab, send out variable.

in tabcontrol have

somename = new dumbo  each tab tabpage in me.tabpages     tab.tag = somename next 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -