|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Implement Icomparablewhen I click on the column header (some, but not all the column headers) to sort?? sqlDR = sqlCMD.ExecuteReader Dim intCol As Integer With sqlDR If .HasRows Then DataGridViewProducts.Rows.Clear() For intCol = 0 To .FieldCount - 1 DataGridViewProducts.Columns.Add(.GetName(intCol), ..GetName(intCol)) Next DataGridViewProducts.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.ColumnHeader While .Read Dim objCells(intCol) As Object .GetValues(objCells) DataGridViewProducts.Rows.Add(objCells) End While .Close() End If End With Hi Jim, I guess it's because for some types you have there isn't a
default comparer (like you have, for instance, for most numerical types and strings ). What do those columns contain (what's the datatype) ? -T Jim ha scritto: Show quoteHide quote > Creating a datagridView with a dataReader. Why do I get this message > when I click on the column header (some, but not all the column > headers) to sort?? > > sqlDR = sqlCMD.ExecuteReader > Dim intCol As Integer > > With sqlDR > If .HasRows Then > DataGridViewProducts.Rows.Clear() > For intCol = 0 To .FieldCount - 1 > DataGridViewProducts.Columns.Add(.GetName(intCol), > .GetName(intCol)) > Next > > DataGridViewProducts.AutoSizeColumnsMode = > DataGridViewAutoSizeColumnsMode.ColumnHeader > While .Read > Dim objCells(intCol) As Object > .GetValues(objCells) > DataGridViewProducts.Rows.Add(objCells) > > End While > .Close() > End If > End With Thats what makes this so confusing. I can sort an int column, a
varchar(200) column, but varchar(10) gives me the Implement Icomparable error message. Being new to .NET this stuff is really confusing, and any help would be greatly appreciated. There also doesn't appear to be any way to turn off sorting in the datagridView. On 16 Dec 2006 17:12:10 -0800, "tommaso.gasta***@uniroma1.it" <Tommaso.Gasta***@gmail.com> wrote: Show quoteHide quote >Hi Jim, I guess it's because for some types you have there isn't a >default comparer (like you have, for instance, for most numerical types >and strings ). > >What do those columns contain (what's the datatype) ? > >-T > >Jim ha scritto: > >> Creating a datagridView with a dataReader. Why do I get this message >> when I click on the column header (some, but not all the column >> headers) to sort?? >> >> sqlDR = sqlCMD.ExecuteReader >> Dim intCol As Integer >> >> With sqlDR >> If .HasRows Then >> DataGridViewProducts.Rows.Clear() >> For intCol = 0 To .FieldCount - 1 >> DataGridViewProducts.Columns.Add(.GetName(intCol), >> .GetName(intCol)) >> Next >> >> DataGridViewProducts.AutoSizeColumnsMode = >> DataGridViewAutoSizeColumnsMode.ColumnHeader >> While .Read >> Dim objCells(intCol) As Object >> .GetValues(objCells) >> DataGridViewProducts.Rows.Add(objCells) >> >> End While >> .Close() >> End If >> End With
I want to KEEP trailing zeros
Convert a date string Create button control at runtime SP1 Install - was it successful? SQL Server Authentication issues! Anyone know where I can download csharp develepper? Windows Service, Process.Start Need some For Loop Next Item Add values in 1-dimensional array How to use Shell Extensions class from Eduardo Morcillo |
|||||||||||||||||||||||