D
dr. p. dietz
Hello,
i'm near a depression by using the datagrid...
My Form has "only" one Datagrid 'dgProt',on form_load i
create a dataset 'ds' by first using a dataadapter and
second adding some calculated columns. This ds is the
datasource of the datagrid, datamember is the only one
table 'protokoll' in the dataset.
Me.dgProt.SetDataBinding(ds, "protokoll")
Ok, the grid shows the data. On doubleclick or select a
menuitem, i want to get the currentrow for further
reactions:
I've tried:
Dim x As DataRowView, Id, n
x = Me.BindingContext(ds, "protokoll").Current
Id = x!naqs_nr (the index-column i need)
or:
Dim cm As CurrencyManager = CType(Me.BindingContext
(Me.dgProt.DataSource, Me.dgProt.DataMember),
CurrencyManager)
Dim dv As DataView = CType(cm.List, DataView)
Dim x As DataRow
x = dv.Item(cm.Position).Row
id=x!naqs_nr
or:
Dim bm As BindingManagerBase = Me.BindingContext
(Me.dgProt.DataSource, Me.dgProt.DataMember)
x = CType(bm.Current, DataRowView).Row
Id = x!naqs_nr
------------
The first time, every thing is fine, but after changing
the dataset (e.g. repopulate it by ds.tables
(protokoll).clear and refill with dataadapter), or after
sorting it, i always get the first row. I'v tried to Re-
Bind the datagrid, different other possibilities, but no
effect...
Please help me!
Thanks
Peter
i'm near a depression by using the datagrid...
My Form has "only" one Datagrid 'dgProt',on form_load i
create a dataset 'ds' by first using a dataadapter and
second adding some calculated columns. This ds is the
datasource of the datagrid, datamember is the only one
table 'protokoll' in the dataset.
Me.dgProt.SetDataBinding(ds, "protokoll")
Ok, the grid shows the data. On doubleclick or select a
menuitem, i want to get the currentrow for further
reactions:
I've tried:
Dim x As DataRowView, Id, n
x = Me.BindingContext(ds, "protokoll").Current
Id = x!naqs_nr (the index-column i need)
or:
Dim cm As CurrencyManager = CType(Me.BindingContext
(Me.dgProt.DataSource, Me.dgProt.DataMember),
CurrencyManager)
Dim dv As DataView = CType(cm.List, DataView)
Dim x As DataRow
x = dv.Item(cm.Position).Row
id=x!naqs_nr
or:
Dim bm As BindingManagerBase = Me.BindingContext
(Me.dgProt.DataSource, Me.dgProt.DataMember)
x = CType(bm.Current, DataRowView).Row
Id = x!naqs_nr
------------
The first time, every thing is fine, but after changing
the dataset (e.g. repopulate it by ds.tables
(protokoll).clear and refill with dataadapter), or after
sorting it, i always get the first row. I'v tried to Re-
Bind the datagrid, different other possibilities, but no
effect...
Please help me!
Thanks
Peter