DataGrid Madness!!!!!!!

ricio2000

Member
Joined
May 2, 2005
Messages
18
Location
Hialeah, FL
Programming Experience
1-3
Hi everybody, I have a datagrid that is being populated from a dataset. I want to be able highlight a row and populate the information in the current highlighted row into text boxes whenever i click a button i have called btnModify. Once the information is in the text box. The rest is smooth sailing. Now, I was looking at the following events, dgCusInf_CurrentCellChanged and also dgCusInf_RowHeaderClick which is a protected event, dgCusInf is the name of my datagrid. The first event is triggered as soon as any cell is changed. Not the initial click, but thereafter, it is raised. So thats definitely not what i need. I was looking at the RowHeaderClick event, but it is a protected event. Not sure how to go about implementing its behavior. Maybe some wise mind out there could help me expand my horizons. I need to be able to pull the currently highlighted row upon it being highlighted, it needs to populate certain textboxes. Anyways, hope somebody's been there and done that. Thanks.
 

Immanent_Safety

New member
Joined
May 11, 2005
Messages
3
Programming Experience
3-5
ricio2000 said:
Hi everybody, I have a datagrid that is being populated from a dataset. I want to be able highlight a row and populate the information in the current highlighted row into text boxes whenever i click a button i have called btnModify. Once the information is in the text box. The rest is smooth sailing. Now, I was looking at the following events, dgCusInf_CurrentCellChanged and also dgCusInf_RowHeaderClick which is a protected event, dgCusInf is the name of my datagrid. The first event is triggered as soon as any cell is changed. Not the initial click, but thereafter, it is raised. So thats definitely not what i need. I was looking at the RowHeaderClick event, but it is a protected event. Not sure how to go about implementing its behavior. Maybe some wise mind out there could help me expand my horizons. I need to be able to pull the currently highlighted row upon it being highlighted, it needs to populate certain textboxes. Anyways, hope somebody's been there and done that. Thanks.
I've been doing something like this for a few months..
When I want a string from a certain row-column in a datagrid, I use this..

VB.NET:
'this item is going to hold the string value for the cell or "item" you want
Dim Thisitem As String

'              DataGrid1.Item(X,Y)  this selects an item from the DataGrid
'              using two integers.   (row,column)
'              CurrentRowIndex returns an integer of the selected row
'              then you just tell it which column you want to use,
'              in this case I'm using the first column because the datagrid
'              starts at zero
Thisitem = DataGrid1.Item(DataGrid1.CurrentRowIndex(), 0)
Hope that helps
 
Top Bottom