Solved

move textbox or label controls to specific XY location

Posted on 2006-06-14
6
1,282 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
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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 39

Accepted Solution

by:
appari earned 125 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

730 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