INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Visual Basic (Microsoft) Versions 5/6 FAQ

DataGrid

How to unlock the DataGrid after dblclick showing a modal dialog by Amador
Posted: 10 Sep 03

The datagrid control uses the sequence of MouseDown, MouseUp, MouseDown, MouseUp to fire a double click event. When you open a Modal dialog in the double click event, for some reason, the last MouseUp message is sent to the modal dialog, but not to the DataGrid. When the modal dialog is closed, the DataGrid is still waiting for the MouseUp Message, so the problem Occurs.

A similar problem is addressed in <http://support.microsoft.com/?id=305101>;

To work aroud the problem the MouseUp message has to be sent manually to the Datagrid by calling the mouse_event API. See the next example:

Option Explicit

Private Declare Sub mouse_event Lib "user32" ( _
    ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, _
    ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Private Const MOUSEEVENTF_LEFTUP = &H4

Private Sub DataGrid1_DblClick()
    With DataGrid1
        frmCalendar.Show vbModal
        .Text = CStr(gDate)

    End With
       
    mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
       
End Sub

Back to Visual Basic (Microsoft) Versions 5/6 FAQ Index
Back to Visual Basic (Microsoft) Versions 5/6 Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close