In 2003 I could set, for instance, the datagrid.item() and datagrid.select() to select a row after filtering the dataview results. These aren't available in 2005, how can this now be achieved
The DataGrid.Item() method didn't exists in .NET Framework 1.1, that is a DataGrid.Item property as still can be found in the .NET Framework 2.0 as you can see on MSDN.
Here what is happening. The item property is actually a named indexer property. In order to access this item in C#, you would use the "[ ]" syntax to set the value of that Item:
I can repro what you're seeing with the item property. Going to the metadata view of DataGridView (using Go to Definition) shows that the property isn't a member of DataGridView, which is why it's not showing up in IntelliSense.
I've sent this post to members of the WinForms team though to see what's going on. I'll post back with results.
I created a datagrid instance in code and I still didn't get "item" in intelli-sense. I've also read that the datagridview will be the future of the datagrid so it contains most of the same properties anyway.
2005 .item() & .Select() replacements?
BhavinG
Randall Sutton
The DataGrid.Select() does also still exists in .NET Framework 2.0.
So they are unchanged!
dispehrse
not really a whole lot of code to show. I drew a datagridview on a windows form.
The code generated by VS is:
this.dg1 = new System.Windows.Forms.DataGridView();((System.ComponentModel.
ISupportInitialize)(this.dg1)).BeginInit();in form1 load event I try to enter:
dg1.Item but "Item" doesn't show up and it gives the error I posted previously.
The strange thing is if I do the same thing in VB, intelli-sense does show "Item" property.
But I've yet to find a solution for the .Select method for selecting a specific row for either.
LenKelly
actually I never said that .item was a method but for some reason it doesn't show up in intellisense for my datagrid instance;
in 2003 .select selected a specified row, in 2005 it activates the control.
Raffaele Fazio
Cat Herder
suedueno -
Here what is happening. The item property is actually a named indexer property. In order to access this item in C#, you would use the "[ ]" syntax to set the value of that Item:
dataGridView1[colIndex, rowIndex].Value = "foobar";
Since this is a named indexer, it is accessible through VB with dataGridView1.Item(...)
The MSDN documentation is misleading -- we're having our doc writers update this document.
HTH,
Karen
BydandConsulting
// Create a DataGridView reference.
DataGridView view = (DataGridView)dg1;
- or -
// Cast it and use it directly.
((DataGridView)db1).Item;
Mei Liang - MSFT
You indicated it as Item(), so that stands for a method because of the ().
But anyway they shop up in my intelli-sense here. When you just type them and use them, do you get any error on compile time
Molavi
suedueno -
I can repro what you're seeing with the item property. Going to the metadata view of DataGridView (using Go to Definition) shows that the property isn't a member of DataGridView, which is why it's not showing up in IntelliSense.
I've sent this post to members of the WinForms team though to see what's going on. I'll post back with results.
Thanks!
Karen
Ricardo Casquete
macadam
Reverend
still no Item property in intellisense.
I did figure out the row select method in 2005 though, dgv.Rows
.Select = true;
.
which is slightly different from 2003, dgv.Select
Netscorpion
Can you share us the source that give's the error, because when i test it here. I can't get any error you talking about.