Mouse location

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adriano

    Mouse location

    hello,

    is there any code to catch mouse move?
    I mean to catch X and Y locations on a form?

    tnx in advance,
    Adriano


  • rawCoder

    #2
    Re: Mouse location

    Hi Adriano,

    Try handling the MouseMove Event and in the event arguments you will be able
    to retrieve the Mouse Position Coordinates
    something like this
    Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As
    System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e

    Debug.WriteLine (e.X & "," & e.Y)

    End Sub

    Hope it helps
    rawCoder

    "Adriano" <adriano@tadaz. com> wrote in message
    news:eRROj3YXEH A.1144@TK2MSFTN GP10.phx.gbl...[color=blue]
    > hello,
    >
    > is there any code to catch mouse move?
    > I mean to catch X and Y locations on a form?
    >
    > tnx in advance,
    > Adriano
    >
    >[/color]


    Comment

    • Adriano

      #3
      Re: Mouse location

      hello Coder,
      I tried this but the following error message appears:

      Method 'FormClick_Mous eMove' cannot handle Event 'MouseMove' because they do
      not have the same signature.

      any other ideas?

      "rawCoder" <rawCoder@hotma il.com> wrote in message
      news:Ol1x5cZXEH A.644@tk2msftng p13.phx.gbl...[color=blue]
      > Hi Adriano,
      >
      > Try handling the MouseMove Event and in the event arguments you will be[/color]
      able[color=blue]
      > to retrieve the Mouse Position Coordinates
      > something like this
      > Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As
      > System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e
      >
      > Debug.WriteLine (e.X & "," & e.Y)
      >
      > End Sub
      >
      > Hope it helps
      > rawCoder
      >
      > "Adriano" <adriano@tadaz. com> wrote in message
      > news:eRROj3YXEH A.1144@TK2MSFTN GP10.phx.gbl...[color=green]
      > > hello,
      > >
      > > is there any code to catch mouse move?
      > > I mean to catch X and Y locations on a form?
      > >
      > > tnx in advance,
      > > Adriano
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Mouse location

        * "rawCoder" <rawCoder@hotma il.com> scripsit:[color=blue]
        > Try handling the MouseMove Event and in the event arguments you will be able
        > to retrieve the Mouse Position Coordinates
        > something like this
        > Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As
        > System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e
        >
        > Debug.WriteLine (e.X & "," & e.Y)
        >
        > End Sub[/color]

        Outside this event, you can use 'Cursor.Positio n' to get the mouse
        position.

        --
        Herfried K. Wagner [MVP]
        <URL:http://dotnet.mvps.org/>

        Comment

        • rawCoder

          #5
          Re: Mouse location

          Did you use the IDE to get the signature of method .. like from top
          ComboBoxes by selecting Base and Overrides and then selecting MouseMove
          method. Or did u write it yourself. If later is the case, do try it using
          the IDE. You may wanna post the Signture here so that the problem can be
          identified.

          frankly I dont remember any signature.. not even Form_Load ... so gotta
          trust the IDE. Thanx its not C# and the IDe is on our side;-)

          Thank You
          rawCoder

          "Adriano" <adriano@tadaz. com> wrote in message
          news:uAGKO%23aX EHA.2972@TK2MSF TNGP12.phx.gbl. ..[color=blue]
          > hello Coder,
          > I tried this but the following error message appears:
          >
          > Method 'FormClick_Mous eMove' cannot handle Event 'MouseMove' because they[/color]
          do[color=blue]
          > not have the same signature.
          >
          > any other ideas?
          >
          > "rawCoder" <rawCoder@hotma il.com> wrote in message
          > news:Ol1x5cZXEH A.644@tk2msftng p13.phx.gbl...[color=green]
          > > Hi Adriano,
          > >
          > > Try handling the MouseMove Event and in the event arguments you will be[/color]
          > able[color=green]
          > > to retrieve the Mouse Position Coordinates
          > > something like this
          > > Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As
          > > System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e
          > >
          > > Debug.WriteLine (e.X & "," & e.Y)
          > >
          > > End Sub
          > >
          > > Hope it helps
          > > rawCoder
          > >
          > > "Adriano" <adriano@tadaz. com> wrote in message
          > > news:eRROj3YXEH A.1144@TK2MSFTN GP10.phx.gbl...[color=darkred]
          > > > hello,
          > > >
          > > > is there any code to catch mouse move?
          > > > I mean to catch X and Y locations on a form?
          > > >
          > > > tnx in advance,
          > > > Adriano
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Adriano

            #6
            Re: Mouse location

            I'm a beginner so I used IDE to write the code,
            here is the code:

            Private Sub FormClick_Mouse Move(ByVal sender As System.Object, ByVal e As
            System.EventArg s) Handles MyBase.MouseMov e

            TextBox3.Text = Form1.MousePosi tion.X

            TextBox4.Text = Form1.MousePosi tion.Y

            End Sub



            "rawCoder" <rawCoder@hotma il.com> wrote in message
            news:Ovu#LocXEH A.2408@tk2msftn gp13.phx.gbl...[color=blue]
            > Did you use the IDE to get the signature of method .. like from top
            > ComboBoxes by selecting Base and Overrides and then selecting MouseMove
            > method. Or did u write it yourself. If later is the case, do try it using
            > the IDE. You may wanna post the Signture here so that the problem can be
            > identified.
            >
            > frankly I dont remember any signature.. not even Form_Load ... so gotta
            > trust the IDE. Thanx its not C# and the IDe is on our side;-)
            >
            > Thank You
            > rawCoder
            >
            > "Adriano" <adriano@tadaz. com> wrote in message
            > news:uAGKO%23aX EHA.2972@TK2MSF TNGP12.phx.gbl. ..[color=green]
            > > hello Coder,
            > > I tried this but the following error message appears:
            > >
            > > Method 'FormClick_Mous eMove' cannot handle Event 'MouseMove' because[/color][/color]
            they[color=blue]
            > do[color=green]
            > > not have the same signature.
            > >
            > > any other ideas?
            > >
            > > "rawCoder" <rawCoder@hotma il.com> wrote in message
            > > news:Ol1x5cZXEH A.644@tk2msftng p13.phx.gbl...[color=darkred]
            > > > Hi Adriano,
            > > >
            > > > Try handling the MouseMove Event and in the event arguments you will[/color][/color][/color]
            be[color=blue][color=green]
            > > able[color=darkred]
            > > > to retrieve the Mouse Position Coordinates
            > > > something like this
            > > > Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As
            > > > System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e
            > > >
            > > > Debug.WriteLine (e.X & "," & e.Y)
            > > >
            > > > End Sub
            > > >
            > > > Hope it helps
            > > > rawCoder
            > > >
            > > > "Adriano" <adriano@tadaz. com> wrote in message
            > > > news:eRROj3YXEH A.1144@TK2MSFTN GP10.phx.gbl...
            > > > > hello,
            > > > >
            > > > > is there any code to catch mouse move?
            > > > > I mean to catch X and Y locations on a form?
            > > > >
            > > > > tnx in advance,
            > > > > Adriano
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • rawCoder

              #7
              Re: Mouse location

              Hi adriano,

              I dont know how the IDE got it bungled , but the second argument should be
              MouseEventArgs not EventArgs ... so your code should look like this

              Private Sub FormClick_Mouse Move(ByVal sender As System.Object, ByVal e As
              System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e

              ' You can use e.x here as this will have the coordinates as well and do type
              cast
              TextBox3.Text = e.x
              TextBox4.Text = e.y

              End Sub

              Hope this helps.
              rawCoder

              "Adriano" <adriano@tadaz. com> wrote in message
              news:uucJBMlXEH A.4000@TK2MSFTN GP09.phx.gbl...[color=blue]
              > I'm a beginner so I used IDE to write the code,
              > here is the code:
              >
              > Private Sub FormClick_Mouse Move(ByVal sender As System.Object, ByVal e As
              > System.EventArg s) Handles MyBase.MouseMov e
              >
              > TextBox3.Text = Form1.MousePosi tion.X
              >
              > TextBox4.Text = Form1.MousePosi tion.Y
              >
              > End Sub
              >
              >
              >
              > "rawCoder" <rawCoder@hotma il.com> wrote in message
              > news:Ovu#LocXEH A.2408@tk2msftn gp13.phx.gbl...[color=green]
              > > Did you use the IDE to get the signature of method .. like from top
              > > ComboBoxes by selecting Base and Overrides and then selecting MouseMove
              > > method. Or did u write it yourself. If later is the case, do try it[/color][/color]
              using[color=blue][color=green]
              > > the IDE. You may wanna post the Signture here so that the problem can be
              > > identified.
              > >
              > > frankly I dont remember any signature.. not even Form_Load ... so gotta
              > > trust the IDE. Thanx its not C# and the IDe is on our side;-)
              > >
              > > Thank You
              > > rawCoder
              > >
              > > "Adriano" <adriano@tadaz. com> wrote in message
              > > news:uAGKO%23aX EHA.2972@TK2MSF TNGP12.phx.gbl. ..[color=darkred]
              > > > hello Coder,
              > > > I tried this but the following error message appears:
              > > >
              > > > Method 'FormClick_Mous eMove' cannot handle Event 'MouseMove' because[/color][/color]
              > they[color=green]
              > > do[color=darkred]
              > > > not have the same signature.
              > > >
              > > > any other ideas?
              > > >
              > > > "rawCoder" <rawCoder@hotma il.com> wrote in message
              > > > news:Ol1x5cZXEH A.644@tk2msftng p13.phx.gbl...
              > > > > Hi Adriano,
              > > > >
              > > > > Try handling the MouseMove Event and in the event arguments you will[/color][/color]
              > be[color=green][color=darkred]
              > > > able
              > > > > to retrieve the Mouse Position Coordinates
              > > > > something like this
              > > > > Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As
              > > > > System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e
              > > > >
              > > > > Debug.WriteLine (e.X & "," & e.Y)
              > > > >
              > > > > End Sub
              > > > >
              > > > > Hope it helps
              > > > > rawCoder
              > > > >
              > > > > "Adriano" <adriano@tadaz. com> wrote in message
              > > > > news:eRROj3YXEH A.1144@TK2MSFTN GP10.phx.gbl...
              > > > > > hello,
              > > > > >
              > > > > > is there any code to catch mouse move?
              > > > > > I mean to catch X and Y locations on a form?
              > > > > >
              > > > > > tnx in advance,
              > > > > > Adriano
              > > > > >
              > > > > >
              > > > >
              > > > >
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • Adriano

                #8
                Re: Mouse location

                now it works fine!!!
                i appreciate your time and help,

                Adriano

                "rawCoder" <rawCoder@hotma il.com> wrote in message
                news:eK$reXmXEH A.3564@TK2MSFTN GP11.phx.gbl...[color=blue]
                > Hi adriano,
                >
                > I dont know how the IDE got it bungled , but the second argument should be
                > MouseEventArgs not EventArgs ... so your code should look like this
                >
                > Private Sub FormClick_Mouse Move(ByVal sender As System.Object, ByVal e As
                > System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e
                >
                > ' You can use e.x here as this will have the coordinates as well and do[/color]
                type[color=blue]
                > cast
                > TextBox3.Text = e.x
                > TextBox4.Text = e.y
                >
                > End Sub
                >
                > Hope this helps.
                > rawCoder
                >
                > "Adriano" <adriano@tadaz. com> wrote in message
                > news:uucJBMlXEH A.4000@TK2MSFTN GP09.phx.gbl...[color=green]
                > > I'm a beginner so I used IDE to write the code,
                > > here is the code:
                > >
                > > Private Sub FormClick_Mouse Move(ByVal sender As System.Object, ByVal e[/color][/color]
                As[color=blue][color=green]
                > > System.EventArg s) Handles MyBase.MouseMov e
                > >
                > > TextBox3.Text = Form1.MousePosi tion.X
                > >
                > > TextBox4.Text = Form1.MousePosi tion.Y
                > >
                > > End Sub
                > >
                > >
                > >
                > > "rawCoder" <rawCoder@hotma il.com> wrote in message
                > > news:Ovu#LocXEH A.2408@tk2msftn gp13.phx.gbl...[color=darkred]
                > > > Did you use the IDE to get the signature of method .. like from top
                > > > ComboBoxes by selecting Base and Overrides and then selecting[/color][/color][/color]
                MouseMove[color=blue][color=green][color=darkred]
                > > > method. Or did u write it yourself. If later is the case, do try it[/color][/color]
                > using[color=green][color=darkred]
                > > > the IDE. You may wanna post the Signture here so that the problem can[/color][/color][/color]
                be[color=blue][color=green][color=darkred]
                > > > identified.
                > > >
                > > > frankly I dont remember any signature.. not even Form_Load ... so[/color][/color][/color]
                gotta[color=blue][color=green][color=darkred]
                > > > trust the IDE. Thanx its not C# and the IDe is on our side;-)
                > > >
                > > > Thank You
                > > > rawCoder
                > > >
                > > > "Adriano" <adriano@tadaz. com> wrote in message
                > > > news:uAGKO%23aX EHA.2972@TK2MSF TNGP12.phx.gbl. ..
                > > > > hello Coder,
                > > > > I tried this but the following error message appears:
                > > > >
                > > > > Method 'FormClick_Mous eMove' cannot handle Event 'MouseMove' because[/color]
                > > they[color=darkred]
                > > > do
                > > > > not have the same signature.
                > > > >
                > > > > any other ideas?
                > > > >
                > > > > "rawCoder" <rawCoder@hotma il.com> wrote in message
                > > > > news:Ol1x5cZXEH A.644@tk2msftng p13.phx.gbl...
                > > > > > Hi Adriano,
                > > > > >
                > > > > > Try handling the MouseMove Event and in the event arguments you[/color][/color][/color]
                will[color=blue][color=green]
                > > be[color=darkred]
                > > > > able
                > > > > > to retrieve the Mouse Position Coordinates
                > > > > > something like this
                > > > > > Private Sub Form1_MouseMove (ByVal sender As Object, ByVal e As
                > > > > > System.Windows. Forms.MouseEven tArgs) Handles MyBase.MouseMov e
                > > > > >
                > > > > > Debug.WriteLine (e.X & "," & e.Y)
                > > > > >
                > > > > > End Sub
                > > > > >
                > > > > > Hope it helps
                > > > > > rawCoder
                > > > > >
                > > > > > "Adriano" <adriano@tadaz. com> wrote in message
                > > > > > news:eRROj3YXEH A.1144@TK2MSFTN GP10.phx.gbl...
                > > > > > > hello,
                > > > > > >
                > > > > > > is there any code to catch mouse move?
                > > > > > > I mean to catch X and Y locations on a form?
                > > > > > >
                > > > > > > tnx in advance,
                > > > > > > Adriano
                > > > > > >
                > > > > > >
                > > > > >
                > > > > >
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                Working...