Click here to Skip to main content
15,895,799 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Sql File in DLL problem Pin
anom2m17-May-06 0:45
anom2m17-May-06 0:45 
GeneralRe: Sql File in DLL problem Pin
Rizwan Bashir17-May-06 5:32
Rizwan Bashir17-May-06 5:32 
QuestionA question about event handlers Pin
carloqueirolo6-May-06 21:18
carloqueirolo6-May-06 21:18 
AnswerRe: A question about event handlers Pin
Robert Rohde6-May-06 21:51
Robert Rohde6-May-06 21:51 
GeneralRe: A question about event handlers Pin
carloqueirolo6-May-06 22:04
carloqueirolo6-May-06 22:04 
GeneralRe: A question about event handlers Pin
Robert Rohde7-May-06 20:26
Robert Rohde7-May-06 20:26 
GeneralRe: A question about event handlers Pin
carloqueirolo7-May-06 21:15
carloqueirolo7-May-06 21:15 
QuestionDataGridView - SortCompare event not firing! Pin
nzmike6-May-06 18:08
nzmike6-May-06 18:08 
Hi all,

I have a Winforms 2.0 app in which I have a DataGridView which is populated from my own data objects (ie: from my own classes, not from a database or strongly typed dataset). The DGV is readonly so no editing or adding new rows can be done. Since some of the columns need to have a custom sort I set the SortMode property on those columns to "Programmatic" and then added the following event handler to the code:

Private Sub dgvMeetings_SortCompare(ByVal sender As System.Object, ByVal e As DataGridViewSortCompareEventArgs) Handles dgvMeetings.SortCompare

'Try to sort based on the columns in the current column.
e.SortResult = System.String.Compare(e.CellValue1.ToString(), e.CellValue2.ToString())

'If the cells are equal, sort based on the race start time column
If e.SortResult = 0 Then
e.SortResult = System.String.Compare(dgvMeetings.Rows(e.RowIndex1).Cells("RaceDate").Value.ToString(), _ dgvMeetings.Rows(e.RowIndex2).Cells("RaceDate").Value.ToString())
End If

e.Handled = True

End Sub

However, this event is simply not firing at all... I can click on the column headers until I'm blue in the face and the event never fires. The columns in the DGV that are set to sort automatically work fine so would anyone know why SortCompare is not working? I also tried adding an AddHandler which pointed to the same method (without the "Handles ..." of course) and it still ignores it. I actually got the code above from the MS document about the DGV (at http://download.microsoft.com/download/5/6/4/5646742C-3EB7-48F7-BFB3-CC295D618CF9/DataGridView%20FAQ.doc) in which it says this is the way to custom sort unbound data - but it doesn't seem to work for me... anyone know what I might be missing here?

TIA for any help...

Mike



-- modified at 0:13 Sunday 7th May, 2006
AnswerRe: DataGridView - SortCompare event not firing! Pin
nzmike6-May-06 20:04
nzmike6-May-06 20:04 
Questiontime stamp value Pin
_tasleem6-May-06 10:48
_tasleem6-May-06 10:48 
Questionpopulating the Combo box with database tables Pin
Hafiz_Akbar_Ali6-May-06 8:39
Hafiz_Akbar_Ali6-May-06 8:39 
Questionformat(now,"dd/mm/yyyy") not working in vb.net Pin
pptadam6-May-06 6:52
pptadam6-May-06 6:52 
AnswerRe: format(now,"dd/mm/yyyy") not working in vb.net Pin
Joshua Quick6-May-06 9:17
Joshua Quick6-May-06 9:17 
QuestionValidate data in a table Pin
phokojoe6-May-06 3:12
phokojoe6-May-06 3:12 
AnswerRe: Validate data in a table Pin
mr_123456-May-06 10:04
mr_123456-May-06 10:04 
GeneralRe: Validate data in a table Pin
phokojoe7-May-06 1:32
phokojoe7-May-06 1:32 
GeneralRe: Validate data in a table Pin
phokojoe9-May-06 22:47
phokojoe9-May-06 22:47 
QuestionReading from notepad File Pin
Mr kilany6-May-06 3:08
Mr kilany6-May-06 3:08 
AnswerRe: Reading from notepad File Pin
Colin Angus Mackay6-May-06 3:15
Colin Angus Mackay6-May-06 3:15 
AnswerRe: Reading from notepad File Pin
kkppttoo7-May-06 0:49
kkppttoo7-May-06 0:49 
Questiondouble rows Pin
microuser_20006-May-06 2:03
microuser_20006-May-06 2:03 
QuestionCopy Objects - Am I missing something? Pin
Kaditcher6-May-06 1:07
Kaditcher6-May-06 1:07 
AnswerRe: Copy Objects - Am I missing something? Pin
Joshua Quick6-May-06 9:39
Joshua Quick6-May-06 9:39 
GeneralRe: Copy Objects - Am I missing something? Pin
Kaditcher9-May-06 7:24
Kaditcher9-May-06 7:24 
GeneralRe: Copy Objects - Am I missing something? Pin
Joshua Quick9-May-06 17:14
Joshua Quick9-May-06 17:14 

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.