Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > a UserControls MouseDown event


Reply
 
Thread Tools Display Modes
  #1  
Old 11-21-2003, 02:29 PM
eladla eladla is offline
Regular
 
Join Date: Nov 2003
Posts: 67
Default a UserControls MouseDown event


Can`t I implement a usercontrol`s mousedown code in the form that is hosting it?

The instance of the usercontrol on the form is called "Tables", so my code looks like this:

Private Sub Tables_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
DragBegin Tables.Item(Index)
End If
End Sub

and I put a breakpoint inside the if and the program never gets there.
Anyone know what I`m doing wrong?
Reply With Quote
  #2  
Old 11-21-2003, 03:05 PM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,883
Default

Does the usercontrol have a MouseDown event?
Reply With Quote
  #3  
Old 11-21-2003, 04:14 PM
eladla eladla is offline
Regular
 
Join Date: Nov 2003
Posts: 67
Default

I added
Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
to the usercontrol declarations section.
Is that the way to do it?
when I try adding the mousedown code on the usercontrol, it works.
Reply With Quote
  #4  
Old 11-21-2003, 04:19 PM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,883
Default

You have also call the RaiseEvent in the MouseDown event of the UserControl.
Reply With Quote
  #5  
Old 11-21-2003, 04:33 PM
eladla eladla is offline
Regular
 
Join Date: Nov 2003
Posts: 67
Default

Got it.
Thanks.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid mousedown event irri General 2 09-01-2003 05:02 AM
wbc copy to clipboard S1mon General 2 07-14-2003 09:35 AM
MDIForm KeyPress & MouseDown Events coco286 API 5 05-10-2003 10:12 AM
differentiate mousedown from doubleclick airplays General 7 09-22-2002 05:59 PM
Two controls for the (free) price of one Merrion Code Library 5 11-07-2001 04:05 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->