rmokkenstorm Posted March 15, 2006 Posted March 15, 2006 i use this script to select a row from my data grid.. but he doesn't fill it.. what's wrong? my customrow script public void dataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { int rowIndex = dataGrid1.CurrentRowIndex; if (CustomRow != null) { CustomRow(this, new CustomRowEventArgs(barry11,dataGrid1,rowIndex)); } } public class CustomRowEventArgs : EventArgs { DataSet barry11; DataGrid grid; int row; public CustomRowEventArgs(DataSet DSet,DataGrid Grid,int Row) { grid = Grid; row = Row; barry11 = barry11; } public DataSet DSet { get { return barry11; } } public DataGrid Grid { get { return grid; } } public int Row { get { return row; } } and my code to read it out.. at least it should read it.. public virtual void customHandler_CustomRow(object sender, CustomRowEventArgs e) { DataSet DSet = e.DSet; DataGrid dataGrid1 = e.Grid; int row = e.Row; textBox.Text = dataGrid1[e.Row,0].ToString(); } Quote
*Experts* Nerseus Posted March 15, 2006 *Experts* Posted March 15, 2006 I'm not sure what you're doing, but the class CustomRowEventArgs has a constructor that's doing this: barry11 = barry11; I think you want: barry11 = DSet; -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
rmokkenstorm Posted March 16, 2006 Author Posted March 16, 2006 yeah that whas a mistake i saw later. but the problem remains.. Quote
rmokkenstorm Posted March 16, 2006 Author Posted March 16, 2006 can someone send me another script or sample of tutorial to do this right? Quote
Administrators PlausiblyDamp Posted March 16, 2006 Administrators Posted March 16, 2006 If you step through the code in a debugger does it appear to be showing the correct values? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
rmokkenstorm Posted March 16, 2006 Author Posted March 16, 2006 I don't know what you mean .. If I run the script there are no errors.. at least.. he says so... Quote
rmokkenstorm Posted March 17, 2006 Author Posted March 17, 2006 my script now public static event CustomRowHandler CustomRow; public virtual void customHandler_CustomRow(object sender, CustomRowEventArgs e) { Barry1 DSet = e.DSet; DataGrid dataGrid = e.Grid; int row = e.Row; textBox2.Text=barry11.Tables[0].Rows [row]["firstname"].ToString(); public void dataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if (CustomRow != null) { CustomRow(this, new CustomRowEventArgs(barry11,dataGrid,dataGrid.CurrentRowIndex)); } } public class CustomRowEventArgs : EventArgs { Barry1 dataSet; DataGrid grid; int row; public CustomRowEventArgs(Barry1 DSet,DataGrid Grid,int Row) { dataSet = DSet; grid = Grid; row = Row; } public Barry1 DSet { get { return dataSet; } } public DataGrid Grid { get { return grid; } } public int Row { get { return row; } } } I really don't get it... it runs without errors. but i cant read the row in the textbox.. what's wrong? is the code not correct by my currentrowindex.. or is the code bad at the textbox part? 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.