VB.NET – Get Bindingsource Location according to DataTable

I have a data table containing rows of a database table. The table has a primary key formed by 2 columns.

The components are allocated in this way: datatable –> bindingsource –> datagridview. What I want is to search for a specific row (based on the primary key) to select it on the grid. I can’t use the bindingsource.Find method because you can only use one column.

I can access the data table, so I manually search the data table, but how do I get the bindingsource row location based on the data table row? Or is there another solution?

I use Visual Studio 2005, VB.NET.

I Trying to add an answer to this 2 year old question. One way to solve this problem is to append this code after the UpdateAll method (SaveItem_Click):

Me.YourDataSet .Tables("YourTable").Rows(YourBindingSource.Position).Item("YourColumn") = "YourNewValue"

Then call another UpdateAll method.

I have a data table with rows of a database table. The table has a primary key formed by 2 columns.

The components are allocated in this way: datatable -> bindingsource -> datagridview What I want is to search for a specific row (based on the primary key) to select it on the grid. I cannot use the bindingsource.Find method because you can only use one column.

I can access the data table, so I manually search the data table, but how do I get the bindingsource row position based on the data table row? Or is there another solution?

I am using Visual Studio 2005, VB.NET.

I am trying to add an answer to this 2-year-old question. One way to solve this problem is to append this code after the UpdateAll method (SaveItem_Click):

Me.YourDataSet.Tables("YourTable").Rows(YourBindingSource. Position).Item("YourColumn") = "YourNewValue"

Then call another UpdateAll method.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3403 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.