473,473 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

moving the form

hey all,
is there a way to have it where if a user clicks and holds down left mouse
button on a TextBox they will be able to move the form around the desktop?

thanks,
rodchar
Jul 23 '06 #1
7 891
yea...look at the textbox's mousedown and mousemove events.....but this is a
very curious question....can i ask the purpose of this?
--
-iwdu15
Jul 24 '06 #2
i want to make something like post it notes for personal use.

"iwdu15" wrote:
yea...look at the textbox's mousedown and mousemove events.....but this is a
very curious question....can i ask the purpose of this?
--
-iwdu15
Jul 24 '06 #3
ok, so its something like this

''GLobal Var
Private ptOld as Point

Private boolDown as Boolean = False

Private Sub txtStuff_MouseDown(..)

If e.Button = MouseButtons.Left then

ptOld.X = e.x
ptOld.Y = e.y

boolDown = true

end if

end sub
Private SUb txtStuff_MouseMove(.,..)

if boolDown then

Me.left = ptOld.X - e.x
Me.Top = ptOld.Y - e.Y

end if

end sub
Private Sub txtStuff_MouseUp(...)

boolDown = false

end sub

something along those lines

hope this helps

--
-iwdu15
Jul 24 '06 #4
thank you very much.

"iwdu15" wrote:
ok, so its something like this

''GLobal Var
Private ptOld as Point

Private boolDown as Boolean = False

Private Sub txtStuff_MouseDown(..)

If e.Button = MouseButtons.Left then

ptOld.X = e.x
ptOld.Y = e.y

boolDown = true

end if

end sub
Private SUb txtStuff_MouseMove(.,..)

if boolDown then

Me.left = ptOld.X - e.x
Me.Top = ptOld.Y - e.Y

end if

end sub
Private Sub txtStuff_MouseUp(...)

boolDown = false

end sub

something along those lines

hope this helps

--
-iwdu15
Jul 24 '06 #5
Shouldn't that be:

Me.left = Me.left + ptOld.X - e.x
Me.Top = Me.Left + ptOld.Y - e.Y
Me.Refresh
--
Dennis in Houston
"iwdu15" wrote:
ok, so its something like this

''GLobal Var
Private ptOld as Point

Private boolDown as Boolean = False

Private Sub txtStuff_MouseDown(..)

If e.Button = MouseButtons.Left then

ptOld.X = e.x
ptOld.Y = e.y

boolDown = true

end if

end sub
Private SUb txtStuff_MouseMove(.,..)

if boolDown then

Me.left = ptOld.X - e.x
Me.Top = ptOld.Y - e.Y

end if

end sub
Private Sub txtStuff_MouseUp(...)

boolDown = false

end sub

something along those lines

hope this helps

--
-iwdu15
Jul 25 '06 #6
Sorry, that is:

Me.left = Me.Left + ptOld.X - e.x
Me.Top = Me.Top + ptOld.Y - e.Y
--
Dennis in Houston
"iwdu15" wrote:
ok, so its something like this

''GLobal Var
Private ptOld as Point

Private boolDown as Boolean = False

Private Sub txtStuff_MouseDown(..)

If e.Button = MouseButtons.Left then

ptOld.X = e.x
ptOld.Y = e.y

boolDown = true

end if

end sub
Private SUb txtStuff_MouseMove(.,..)

if boolDown then

Me.left = ptOld.X - e.x
Me.Top = ptOld.Y - e.Y

end if

end sub
Private Sub txtStuff_MouseUp(...)

boolDown = false

end sub

something along those lines

hope this helps

--
-iwdu15
Jul 25 '06 #7
Rodchar

Maybe a little bit late after that Iwdu15 has given you the correct answer,
but I should have given you this link for your problem.

I like forever to give this one.
http://www.vb-tips.com/dbpages.aspx?...8-a2eda88e06ee

Cor

"rodchar" <ro*****@discussions.microsoft.comschreef in bericht
news:2F**********************************@microsof t.com...
hey all,
is there a way to have it where if a user clicks and holds down left mouse
button on a TextBox they will be able to move the form around the desktop?

thanks,
rodchar

Jul 25 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can...
2
by: willem | last post by:
Hi, I want move my form with mouse when I press button over a different position from normal bar of title. I set MouseUp, MouseDown and, MouseMove events and all works good. is it...
1
by: dsa | last post by:
Is there a way to determine when a user has stopped moving a form? I know the move event tells when the form is being moved but how do I know when the form has stopped moving?
0
by: Jeff Waskiewicz | last post by:
Here is what I am trying to accomplish. I have an MDI application on the left side of the client area I have a borderless form that holds a treeveiw for navigation. When an item is selected from...
2
by: Diogo Alves - Software Developer | last post by:
Greetings I would like to knowhow can I put a sliding panel... I've done this: if (panel1.Width < 300) { while (panel1.Width < 300) { panel1.Width = panel1.Width + 40;
14
by: bwadley | last post by:
Hi, Im fairly new to VB.NET and am hoping someone can help me with what is probably a simple problem. I have an MDI app, when I open a child form, I want it centered to the parent. So I put...
0
by: Ginger Estherskip | last post by:
How do you programmatically start moving a SDI winform? Here's the issue: I've got a form as part of a tabbed MDI set, and I wrote it so that a user can "tear" the form off of the MDI by...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
In a database search application (vb2005), the user wants to be able to scroll through records using the mousewheel. The data display form contains textboxes for the main data and a datagridview...
0
by: Peter Anthony | last post by:
It seems kind of strange that if a Form is just moved that Resize events fire. This makes it hard to tell the difference betweeen resizing and moving a Form. I can understand why resizing might...
6
by: JB | last post by:
Hi All, I have a Windows Form application that shows a "please wait" form while I query a database for various information. I display my form using Show, then run my DB query, then Close the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.