Solved

move textbox or label controls to specific XY location

Posted on 2006-06-14
6
1,285 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 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

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…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

696 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