?
Solved

move textbox or label controls to specific XY location

Posted on 2006-06-14
6
Medium Priority
?
1,287 Views
Last Modified: 2009-02-28
I have a form that I want to format upon loading.

What i need is code to move textbox and label controls to certain xy positions on the form.

it may be so simple i just missed it, i tried

textbox.Location.X = myX1
textbox.Location.Y = myY1

but when build i get the following error:
"Expression is a value and therefore cannot be the target of an assignment."

Any help would be greatly appreciated.

Eric
0
Comment
Question by:EricJamesOlson
[X]
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
6 Comments
 
LVL 6

Expert Comment

by:SandeepRR
ID: 16909307
Hi EricJamesOlson,

try this, this will work

textbox.Style.Add("LEFT", "0px");
textbox.Style.Add("TOP", "0px");

SandeepRR
0
 
LVL 1

Author Comment

by:EricJamesOlson
ID: 16909332
maybe i should have specified windows forms, which is what i need.  Sorry wasn't specific.

0
 
LVL 1

Author Comment

by:EricJamesOlson
ID: 16909346
Read my own post and thought i was kinda short, didn't mean to be.

Tks for your post SandeepPR, tried it but the Style is not a member of System.Windows.Forms.Textbox.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Accepted Solution

by:
appari earned 500 total points
ID: 16909348

try like this

TextBox1.Location = New System.Drawing.Point(myX1, myY1)
0
 
LVL 4

Expert Comment

by:VIkasumit
ID: 16909404
Hi,

Textbox1.location is good idea and/or simply set TOP and LEFT of Textbox and they will move to that position .....


Textbox1.Top = 230 / mousepoint.y
Textbox1.Left = 400 /mousepoint.x

see the Property listing in Visual studio for text box and set them as per your requirement .....

VIkasumit
0
 
LVL 1

Author Comment

by:EricJamesOlson
ID: 16909469
Appari,  worked like a charm, appreciate it.

Vikasumit,   Thanks also,  good info.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 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