Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

move textbox or label controls to specific XY location

Posted on 2006-06-14
6
Medium Priority
?
1,291 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
Industry Leaders: 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

876 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