Click here to Skip to main content
15,922,574 members
Home / Discussions / C#
   

C#

 
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
robrich11-Aug-05 4:10
robrich11-Aug-05 4:10 
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
Alomgir Miah11-Aug-05 4:24
Alomgir Miah11-Aug-05 4:24 
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
signbit11-Aug-05 4:36
signbit11-Aug-05 4:36 
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
signbit11-Aug-05 4:50
signbit11-Aug-05 4:50 
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
Alomgir Miah11-Aug-05 5:13
Alomgir Miah11-Aug-05 5:13 
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
rudy.net11-Aug-05 18:21
rudy.net11-Aug-05 18:21 
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
signbit12-Aug-05 0:32
signbit12-Aug-05 0:32 
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
rudy.net12-Aug-05 3:48
rudy.net12-Aug-05 3:48 
I though you just wanted to have access to the row that got changed. Anyway, the DataRow has an internal method called "GetCurrentRecordNo" which does what you need. The following code shows you how to access an internal method:
<br />
public int GetRowIndexSelected()<br />
{<br />
	int rowIndex = -1;<br />
	if (grid.DataSource != null)<br />
	{<br />
		DataView dv = (DataView)((DataTable)grid.DataSource).DefaultView;<br />
		DataRowView drv = dv[grid.CurrentCell.RowNumber];<br />
		Type t = drv.Row.GetType();<br />
		MethodInfo mi = t.GetMethod("GetCurrentRecordNo", BindingFlags.NonPublic | BindingFlags.Instance);<br />
		rowIndex = (int)mi.Invoke(drv.Row, null);<br />
	}<br />
	return rowIndex;<br />
}

By the way, to figure out what method to use, I used Reflector[^]
GeneralRe: Finding out which row (in the DataTable) has been clicked by the user... Pin
signbit16-Aug-05 6:44
signbit16-Aug-05 6:44 
GeneralWindows Service Pin
horacyjr11-Aug-05 2:35
horacyjr11-Aug-05 2:35 
GeneralRe: Windows Service Pin
Alomgir Miah11-Aug-05 5:47
Alomgir Miah11-Aug-05 5:47 
GeneralTAB Key problem in COM Client Vs C# Component Pin
Sivakumar R11-Aug-05 2:18
Sivakumar R11-Aug-05 2:18 
GeneralRe: TAB Key problem in COM Client Vs C# Component Pin
rudy.net11-Aug-05 18:31
rudy.net11-Aug-05 18:31 
GeneralRe: TAB Key problem in COM Client Vs C# Component Pin
Sivakumar R11-Aug-05 22:15
Sivakumar R11-Aug-05 22:15 
GeneralRe: TAB Key problem in COM Client Vs C# Component Pin
rudy.net12-Aug-05 9:09
rudy.net12-Aug-05 9:09 
GeneralCtrl+C exception Pin
zaboboa11-Aug-05 2:09
zaboboa11-Aug-05 2:09 
GeneralRe: Ctrl+C exception Pin
MicrosoftBob11-Aug-05 3:24
MicrosoftBob11-Aug-05 3:24 
GeneralRe: Ctrl+C exception Pin
zaboboa11-Aug-05 5:23
zaboboa11-Aug-05 5:23 
GeneralRe: Ctrl+C exception Pin
MicrosoftBob11-Aug-05 5:24
MicrosoftBob11-Aug-05 5:24 
GeneralRe: Ctrl+C exception Pin
zaboboa11-Aug-05 5:51
zaboboa11-Aug-05 5:51 
GeneralRe: Ctrl+C exception Pin
MicrosoftBob11-Aug-05 6:10
MicrosoftBob11-Aug-05 6:10 
QuestionHow to: Activate or open an document in MDI application through a treeview? Pin
bouli11-Aug-05 1:56
bouli11-Aug-05 1:56 
AnswerRe: How to: Activate or open an document in MDI application through a treeview? Pin
Mohamad Al Husseiny11-Aug-05 4:09
Mohamad Al Husseiny11-Aug-05 4:09 
GeneralRe: How to: Activate or open an document in MDI application through a treeview? Pin
bouli11-Aug-05 4:39
bouli11-Aug-05 4:39 
GeneralRe: How to: Activate or open an document in MDI application through a treeview? Pin
MicrosoftBob11-Aug-05 5:00
MicrosoftBob11-Aug-05 5:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.