currency manager

T

Theodore

Hi,
i have a class "MyClass" with a public property of datatable type. I also
have a form with a public property of type "MyClass". The form has a
datagrid which binds to MyClass.Table datatable. While navigating through
the datagrid rows i can see the current position of MyClass.Table object
through the currency manager (ctype(bindingcontext(Myclass.Table),
currencymanager).position). How can i see the current position from within
MyClass object?

Public Class MyClass

Public Sub New
Mybase.New
Table = Get a Table from SQL DB
End Sub

Private _table as datatable

Public Property Table() as Datatable
Get
Return _Table
End Get
Set (ByVal Value as Datatable)
_table = value
End Set
End Property

End Class



Within a form class ......



Private _sclass as MyClass

Public Property sclass() as MyClass
Get
Return _sclass
End Get
Set (ByVal Value as MyClass)
_sclass = value
End Set
End Property

Me.DataGrid.Datasource = sclass.Table



Thanks,

Theodore
 
K

Ken Tucker [MVP]

Hi,

You would have to pass a reference to the currency manager to
the class.


Ken
 
C

Cor Ligthert [MVP]

Theodore,

You make me curious. your myclass is a bad replica from the dataset class.

Why are you doing that?

Cor
 
T

Theo

Hi Ken,
that is what i am doing now, but why isn't it possible to get the currency
manager from within the original class where the datatable is defined?
I am trying to understand how the whole thing works but i don't get a clear
picture. The binding context class seems to work only for controls. I can
define a new bindingcontext object in my class and derive the
currencymanager from the Table object. This will give me a currency manager
that is not affected by any action that happens on the Table object from
within a different class. I want MyClass to be the datasource for other
classes that bind to the Table object simultaneously. What ever action takes
place against the MyClass.Table object in any of these classes should
project its results to all other classes too.

For example if you have two datagrids on a form and one datatable as the
datasource, the changes in any of these datagrids will show in the other one
too. What if you have these datagrids on separate forms and the datatable on
a third class? How would you make this work?

Thanks,
Theodore
 
T

Theo

Hi Cor,
i had to simplify things in my explenation to focus on my problem. MyClass
is not just holding a datatable but does a lot more things. I am not trying
to replicate dataset at all. I just want to keep the data presentation in a
seperate object and that's why MyClass is not a window form class but just
another custom class that inherits from another custom class and implements
some custom interfaces. But all this stuff has nothing to do with my problem
and that's why i didn't mentioned them before.

In fact the form that contains the datagrid is also an object of MyClass and
so is another form that has various controls bound to the table's columns. I
just want to keep all of them syncronized at all times. So how can i have a
common binding for both forms and also be able to access it from within
MyClass???

Thanks,
Theodore
 

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

Top