Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Field details
Message
From
06/07/2006 02:08:53
 
 
To
05/07/2006 13:07:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Forms
Title:
Miscellaneous
Thread ID:
01133895
Message ID:
01134045
Views:
12
DataGridViewRow dr = myDataGridView.CurrentRow;
MessageBox.Show( (string)dr["town"]
Hi, Cetin...

Just a side-note, did you try that code? I still use the BindingContext position and the current view of the source data, but I gave it a try.

I got an error as well - unless I'm missing something, the DataGridViewRow object doesn't seem to have a direct indexer. I had to do the following:
DataGridViewRow dr = myDataGridView.CurrentRow;
MessageBox.Show(  Convert.ToString( dr.Cells["MyColDataGridViewTextBoxColumn"]));     

                           // is the "GridViewTextBoxColumn needed?   Don't know

// or

MessageBox.Show(  Convert.ToString( dr.Cells[ColNumber]));
At any rate, I still prefer the binding context (assuming it's bound data). Plus which, I don't think the DataGridViewRow will work if you want to reference a column in the source data that isn't displayed in the grid.

Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform