Simple Datagrid questions

P

Philip Tepedino

Hi,

I have a datagrid setup to do full-row select. When I select a row, I need
to be able to know what the value of the current row's column X is.. how can
I find the value of a specific column when a row is selected?

i'm very used to VB6's listview, and am trying to learn the datagrid, but it
just seems overly complicated for very simple things.

Any help would be appreciated,

Philip Tepedino
 
M

MCF

This might help:

// Get the BindingManagerBase of the DataTable.
BindingManagerBase bindingMgrBase =
this.BindingContext[myDataSet.myDataTable];
// Get a DataRowView of the selected row of the DataGrid.
DataRowView drv = (DataRowView)bindingMgrBase.Current;
// Get the DataRow from the DataRowView.
DataRow myDataRow = drv.Row;
// Get the DataColumn from the DataRow.
DataColumn dc = myDataRow["ColumnName"];


I'm not sure that's exactly right. Anyway, you need to use the Data Binding
stuff.
 

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