NekoManu Posted September 27, 2004 Posted September 27, 2004 How do I set the current cell programatically? I tried the following code, but I still need to click on the cell before it is selected. Is there a way to make the a cell the selected cell? this.Datagridview.CurrentCell = this.Datagridview.Rows[6].Cells[1]; Quote
TamuTamu Posted October 4, 2004 Posted October 4, 2004 this.dataGrid1.CurrentCell = new DataGridCell(0,0); will select the cell at 0,0. HTH TamuTamu Quote
NekoManu Posted October 4, 2004 Author Posted October 4, 2004 I can not build when using that code. I tried with: grdWord.CurrentCell = new DataGridViewCell(0, 0); which gives the error: Cannot create an instance of the abstract class or interface 'System.Windows.Forms.DataGridViewCell' I tried with: grdWord.CurrentCell = new DataGridViewCell[0, 0]; which gives the error: Cannot implicitly convert type 'System.Windows.Forms.DataGridViewCell[*,*]' to 'System.Windows.Forms.DataGridViewCell' Quote
TamuTamu Posted October 4, 2004 Posted October 4, 2004 No no no, NOT DataGridViewCell() DataGridCell() this.dataGrid1.CurrentCell = new DataGridCell(0,0); No "View". It is a datagrid you're trying to modify isn't it? HTH TamuTamu Quote
TamuTamu Posted October 4, 2004 Posted October 4, 2004 (edited) A sample. Press the button and it will change the selected cell programatically.DataGridCurrentCellTest.zip Edited October 4, 2004 by PlausiblyDamp Quote
NekoManu Posted October 4, 2004 Author Posted October 4, 2004 I tried your example and it does work. But I'm using a datagridview. Quote
TamuTamu Posted October 4, 2004 Posted October 4, 2004 What is a datagridview, is that with VS2005Beta? Quote
TamuTamu Posted October 4, 2004 Posted October 4, 2004 My apologies then, I know nothing of this at present and as far as I can see resources on the net are somewhat limited at present. :( 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.