kilobyte Posted February 1, 2005 Posted February 1, 2005 Hi I'm making a windows app which displays a datagrid. This datagrid has a dataset as its datasource. So far quite simple. My problem is I don't know how to get a reference to the 'current' datarow from the datagrid. I can get the CurrentRowIndex, but this does not necesarrily correspond to the index in the dataset, because rows can have been deleted, or the datagrid might be sorted etc. I'm thinking I can extract an id from the datagrid row, and find the corresponding row in the dataset. But to me this seems to be a sort of roundabout way of doing it. Is there really no better way to do it? I've been looking at the BindingContext, but so far haven't been able to come up with anything good. I hope someone can help me with this annoying problem! Martin N Jensen Quote
eramgarden Posted February 1, 2005 Posted February 1, 2005 I'd say go to 4guysfromrolla.com. There's a comprehensive Datagrid tutorial from Scott Mitchell. That might your answer. Quote
kilobyte Posted February 2, 2005 Author Posted February 2, 2005 Yea, I did the thing with the id now, and that works alright. It still feels like a bit of a roundabout way of doing it though. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.