Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

VB.Net move the button in a form

Posted on 2013-05-30
Last Modified: 2013-06-14
hi, I am design a restaurant system, now I need a Form to show all the table in the room, and need to move the table to the right position.
I am planing create 50 buttons, set the button visible as QTY request, then change each button's position . but how can I make all the button is movable and remember the position?

I am using Visual studio 2010. VB.net

Question by:Simon Chen
  • 5
  • 4
LVL 35

Expert Comment

by:Robert Schutt
ID: 39210208
This seemed rather interesting to me, so I created a project for it and put it on ee-stuff.com, hope this is what you wanted: https://filedb.experts-exchange.com/incoming/ee-stuff/8309-EE_Q_28143113.ZIP 

Note that this is far from complete but it has a couple of nice features already like rotate the 'active' table (press space).

For the actual dragging I used some excellent code from another forum (credit in source).
LVL 35

Accepted Solution

Robert Schutt earned 500 total points
ID: 39210217
Alternative download link: http://schutt.nl/ee/Q_28143113/EE_Q_28143113.ZIP 

Just for reference, this is how it should look if you press Control-L after running the project:

Author Comment

by:Simon Chen
ID: 39210822
WOW, you are so amazing!!!
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center


Author Closing Comment

by:Simon Chen
ID: 39210823
very helpful

Author Comment

by:Simon Chen
ID: 39210832
but if I need to select a table to place an order, how can I do it then?
LVL 35

Expert Comment

by:Robert Schutt
ID: 39210922
Glad you liked it!

Well that depends a lot on how it will be used. You could for example make a hidden text field that shows a related remark/order info and set the info visible/fill the text when a table is clicked, for example in the 'MouseUp' event handler. You know which Control was clicked (check the .Text property) so you can relate this to information from an array or database table.

To give more specific help I would need some more info on what else you want to add or are already using.
LVL 35

Expert Comment

by:Robert Schutt
ID: 39213102
Not sure if that's the way you wanna go but I made a new version with a text box and also fixed some bugs: http://schutt.nl/ee/Q_28143113/EE_Q_28143113_v2.ZIP

Author Comment

by:Simon Chen
ID: 39248672
Dear Robert

thanks a lot!! I have tested your code and found a strange thing, if at the beginning I have move the button I create ,after I save and load again, it will show this table's name on the textbox, all other I didn't move at all, it won't show the name on the textbox
LVL 35

Expert Comment

by:Robert Schutt
ID: 39249500
I just tried but can't reproduce the problem. Can you inspect the saved file for problems, or post it? You could try debugging, put a breakpoint in Sub DoLoadPos() for example, does the arrData() array contain the right info?

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VS.net 2010 11 48
VB.Net/LINQ: ".Contains" condition not finding existing result in MSSQL 16 41
VB.NET 2008 Publish Error 2 34
vb.net winforms sizing/resolution? 4 42
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question