• 0

Getting selected index of a datagrid


Question

Hi

I'm trying to work out how to get the current row being edited in a datagrid.

What i'm trying to do is detect when a certain column changes in the underlying dataset. So for that i'm using the ColumnChanged event on the DataTable class then I can tell when something has been entered into it. I then use the data in that column to get some data from the database and then insert it into the other columns.

Basically its for checking stock in so the user enters the barcode and then it looks it up in the database and enters its details into the grid then the user adds the quantity their checking in. Repeat.

Now how do I get the row index of the row thats currently being edited so that I can insert the data into the datatable on the correct row, i've been trying to work out how I can return the row index and I so far I haven't been able to find a way :(

I'm using a datatable which i've created programatically.

I'm doing this in C# and .NET 1.1

Edited by StuRReaL
Link to comment
https://www.neowin.net/forum/topic/416366-getting-selected-index-of-a-datagrid/
Share on other sites

2 answers to this question

Recommended Posts

  • 0

ooo yeah Winforms :) but i've found the method I need, its not listed in the SDK and its not named the same as the other controls for doing a similar task (most anoying). My problem now is why isn't data entered into a datagrid appearing in my datatable. I wouldn't mind but its bound correctly and i've used the same code elsewhere and it works perfectly :(

I must have some ghosts in my code somewhere.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.