Click here to Skip to main content
       

Visual Basic

 
AnswerRe: Activex can't create object error in VB6.0 PinmemberSimon_Whale29-Nov-12 22:53 
Questionhow to give Chinese characters sa in put in a Text box in vb.net Pinmemberramesh.mandapelly29-Nov-12 22:03 
AnswerRe: how to give Chinese characters sa in put in a Text box in vb.net PinmemberBernhard Hiller29-Nov-12 22:11 
QuestionHow to use c++ class into vba? Pinmembergui.cmsilva29-Nov-12 17:16 
QuestionHow Bind Multiple Columns under Same Label and store in database(VB 2010) Pinmembercharuwaka29-Nov-12 5:06 
QuestionHow to make Login Page For a Windows Application Form(VB 2010) Pinmembercharuwaka29-Nov-12 3:41 
AnswerRe: How to make Login Page For a Windows Application Form(VB 2010) PinmemberZaf Khan1-Dec-12 8:09 
QuestionVB.NET / APPLICATION SETTINGS Pinmembermebjen29-Nov-12 2:17 
AnswerRe: VB.NET / APPLICATION SETTINGS PinmvpDave Kreskowiak29-Nov-12 3:55 
GeneralRe: VB.NET / APPLICATION SETTINGS Pinmembermebjen29-Nov-12 4:29 
GeneralRe: VB.NET / APPLICATION SETTINGS PinmvpDave Kreskowiak29-Nov-12 10:36 
GeneralRe: VB.NET / APPLICATION SETTINGS Pinmembermebjen29-Nov-12 10:57 
GeneralRe: VB.NET / APPLICATION SETTINGS PinmvpDave Kreskowiak29-Nov-12 15:50 
QuestionMouse Down Event and Flag setting Pinmemberbig_col28-Nov-12 19:53 
Hi
 
I have a strange problem which i am not sure if it is an issue in VB
 
Public Class Form1
 
    Private moving As Boolean = False
 
    Private Sub Label2_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label2.MouseDown
        ' if the left button has been pressed

        If e.Button = Windows.Forms.MouseButtons.Left Then
            ' Set the flag to show mouse down

            moving = True
 
        End If
 
    End Sub
 
    Private Sub Label2_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label2.MouseUp
        ' The button was released, reset flag.
        moving = False
 
    End Sub
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label3.Text = moving
    End Sub
 
    Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
 
        Dim eLocation As New System.Drawing.Point(e.X, e.Y)
 
        If moving = True Then
 

            Label1.Text = "X." & e.X & vbCrLf & "Y." & e.Y
            Label2.Location = eLocation
        End If
    End Sub
End Class
 
There is a label on the form and when you click on it is should be dragable on the form. The issue is that the flag is not been set on the mouse down event but I am not sure why or if it is the mouse move event where I test for the flag is always false. If I take the test for the flag out of the mouse move the label follows the mouse with the left mouse button down so all events seem to be working. If I declare the flag as true at start up the label also follows the mouse until the left button is pressed and released resetting the flag. I have also tried removing the flag reset in mouse up event, this actually starts to work when the left button is released.
 
Any help would be appreciated
Col
VB Express 2010
AnswerRe: Mouse Down Event and Flag setting PinmemberSimon_Whale28-Nov-12 22:46 
GeneralRe: Mouse Down Event and Flag setting Pinmemberbig_col29-Nov-12 2:09 
GeneralRe: Mouse Down Event and Flag setting PinmemberSimon_Whale29-Nov-12 3:06 
AnswerRe: Mouse Down Event and Flag setting Pinmemberbig_col29-Nov-12 20:19 
AnswerRe: Mouse Down Event and Flag setting PinmemberAlan N29-Nov-12 3:09 
Questionvb6 to .net Pinmemberdvdljns28-Nov-12 7:42 
AnswerRe: vb6 to .net PinmemberZaf Khan28-Nov-12 16:58 
GeneralRe: vb6 to .net Pinmemberdvdljns1-Dec-12 5:47 
GeneralRe: vb6 to .net PinmemberZaf Khan1-Dec-12 8:00 
AnswerRe: vb6 to .net PinmvpDave Kreskowiak28-Nov-12 18:04 
QuestionDeleting a datarow, creating a query to find the row. - ANSWERED, Thank yo [modified] PinmemberJRHibner27-Nov-12 23:30 
AnswerRe: Deleting a datarow, creating a query to find the row. PinmemberAndy_L_J28-Nov-12 22:30 
GeneralRe: Deleting a datarow, creating a query to find the row. PinmemberJRHibner1-Dec-12 7:21 
GeneralRe: Deleting a datarow, creating a query to find the row. PinmemberAndy_L_J1-Dec-12 20:27 
GeneralRe: Deleting a datarow, creating a query to find the row. PinmemberJRHibner9-Dec-12 14:55 
QuestionModified Registry Key Pinmemberalirezamansoori27-Nov-12 18:52 
AnswerRe: Modified Registry Key PinmvpRichard MacCutchan28-Nov-12 0:02 
GeneralRe: Modified Registry Key Pinmemberalirezamansoori28-Nov-12 0:39 
GeneralRe: Modified Registry Key PinmvpRichard MacCutchan28-Nov-12 1:15 
QuestionLooking for idea for learning book PinmemberNaZReD24-Nov-12 9:08 
AnswerRe: Looking for idea for learning book PinmemberEddy Vluggen27-Nov-12 12:58 
QuestionInstall SQL Server on Another Computer without reach there PinmemberUmesh Bachchani24-Nov-12 7:03 
AnswerRe: Install SQL Server on Another Computer without reach there PinmemberEddy Vluggen27-Nov-12 12:59 
Question8queen ga write in vb Pinmemberbakhshipoor21-Nov-12 9:42 
AnswerRe: 8queen ga write in vb PinmemberDavid Mujica21-Nov-12 10:16 
AnswerRe: 8queen ga write in vb PinmvpRichard MacCutchan21-Nov-12 22:13 
QuestionOnline handwriting recognition system using vector machine [modified] PinmemberHafiqWiselman21-Nov-12 1:39 
RantRe: Online handwriting recognition system using vector machine PinmemberRichard Deeming21-Nov-12 2:16 
GeneralRe: Online handwriting recognition system using vector machine PinmemberHafiqWiselman21-Nov-12 3:22 
QuestionControlling Monitor brightness from VB6 PinmemberMuhammed Niyas19-Nov-12 23:59 
AnswerRe: Controlling Monitor brightness from VB6 PinmemberSimon_Whale20-Nov-12 0:12 
QuestionExport Data from Gridview to Sql Server PinmemberNaga Raju Vutla18-Nov-12 18:22 
AnswerRe: Export Data from Gridview to Sql Server PinmemberEddy Vluggen19-Nov-12 0:01 
AnswerRe: Export Data from Gridview to Sql Server PinmemberBert Mitton19-Nov-12 8:21 
GeneralRe: Export Data from Gridview to Sql Server PinmemberEddy Vluggen19-Nov-12 9:48 
QuestionReading Complex Type from WSDL Pinmemberasv17-Nov-12 14:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 13 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid