link between gui and objects

  • Thread starter Dries De Rudder
  • Start date
D

Dries De Rudder

hello,

i'm have been thinking a lot about the following thing:

i have a datagrid that has a datatable as its datasource. now i want to
select one row in the datagrid and call a function which needs the
corresponding row from the datatable as its parameter.

how do i find the corresponding row in the datatable when i select a row
in the datagrid.


i was thinking to solve it like this: on the onclick event, get the
index of the selected row in the datagrid en then use that index to
select the row from the datatable. this works fine but i do not believe
that this is the best way to solve my point.

who can help me out?

thx
Dries
 
G

Guest

Hello,

I had to implement something similar recently, and I just used the row index
from the DataGrid. I don't see anything wrong with this. The alternative
would be to build and maintain a cross reference from the DataGrid to the
DataTable, but that is an unneccessary complication if the index is adequate
for your purposes.

To make it general purpuse, I'd use a method

DataRow DataRowOf(int index)

- Javaman
 

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