Solved

move textbox or label controls to specific XY location

Posted on 2006-06-14
6
1,276 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
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 …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now