|
-
Jan 16th, 2005, 11:28 AM
#1
Thread Starter
Hyperactive Member
MouseDown handled clause.
Is there any way to imitate the e.Handled clause for a KeyPress event in a MouseDown event?
"I'm Brian and so is my Wife"
-
Jan 16th, 2005, 12:35 PM
#2
PowerPoster
Re: MouseDown handled clause.
Yes
Exit Sub
would have the same effect as
E.Handled = True
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jan 18th, 2005, 04:38 AM
#3
Thread Starter
Hyperactive Member
Re: MouseDown handled clause.
HiTaxes,
Thanks for your reply.
EXIT SUB may well be the way to go, but this is the problem I am having.
I have a datagrid which is sorted on a hidden column called GRADE_HIDDEN.
Now, when a user clicks on the GRADE column header to sort the datagrid, instead of sorting on GRADE, I want it to be sorted on GRADE_HIDDEN.
This is what I have so far in the MouseDown event of my DataGrid.
VB Code:
Dim myGrid As DataGrid = CType(sender, DataGrid)
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo
Dim view As DataView
'this retrieves the location in the grid that the user clicked using the mouseeventargs for the coordinates
hti = myGrid.HitTest(e.X, e.Y)
Select Case hti.Type 'evaluate the type of hit test info
Case DataGrid.HitTestType.ColumnHeader 'look for the column header
If hti.Column = 5 Then 'the column property indicates the index of the column clicked
view = New DataView(ds.Tables("INCIDENT"), "", "GRADE_HIDDEN", DataViewRowState.CurrentRows)
IncidentList.DataSource = view
Exit Sub
End If
End Select
Now, if I debug this at the Exit Sub line, the grid is indeed sorted on GRADE_HIDDEN.
However, after the Exit Sub, the Sort completes somehow and the grid is re-sorted on the GRADE column.
I suppose what I am asking is "How to re-direct a Datagrid sort to a column other than the one that has been clicked on?"
"I'm Brian and so is my Wife"
-
Jan 18th, 2005, 04:52 AM
#4
PowerPoster
Re: MouseDown handled clause.
Hi,
Then there must be something in your subsequent code which affects it.
Put your breakpoint on the Exit Sub and then use the stepover key (F10) to see where it goes. e.g. is there a click or mouseup event in action?
If that fails use DataGrid.Update before the Exit Sub.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jan 18th, 2005, 05:51 AM
#5
Thread Starter
Hyperactive Member
Re: MouseDown handled clause.
Thanks for your Reply.
I've done as you suggest.
However, the code exits after the Exit Sub and doesn't go elsewhere and no other part of my code is called with relation to the DataGrid.
"I'm Brian and so is my Wife"
-
Jan 18th, 2005, 06:13 AM
#6
PowerPoster
Re: MouseDown handled clause.
Hi,
I think you need to rebind the control immediately before the Exit Sub
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jan 19th, 2005, 01:20 AM
#7
Thread Starter
Hyperactive Member
Re: MouseDown handled clause.
Hi Taxes,
Thought I was doing that already, no?
IncidentList is the name of my DataGrid control.
"I'm Brian and so is my Wife"
-
Jan 19th, 2005, 06:19 AM
#8
PowerPoster
Re: MouseDown handled clause.
Hi,
I'll experiment with it later if no one else has an answer.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jan 20th, 2005, 05:33 AM
#9
Thread Starter
Hyperactive Member
Re: MouseDown handled clause.
I'd appreciate any more input you may have Taxes. Many thanks.
"I'm Brian and so is my Wife"
-
Jan 20th, 2005, 06:59 AM
#10
PowerPoster
Re: MouseDown handled clause.
Hi,
I think you deed to add the line
IncidentList.DataBind() after
IncidentList.DataSource = view
But I also wonder why you have:
IncidentList instead of MyGrid (Although they are interchangable)
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|