Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# location property on textbox control

Posted on 2011-02-10
Medium Priority
271 Views
I would like to use this sentence

for example:
"IF TEXTBOX1.LOCATION = (2,2) THEN"

I know that the sintaxis is not right,

I would like to know how to use the location property in a IF STATEMENT

0
Question by:altariamx2003
[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
• 5
• 2
• 2

LVL 10

Expert Comment

ID: 34868093
0

Author Comment

ID: 34868117
hi himanshut

This is what I need to know to do.

"IF TEXTBOX1.LOCATION = POINT(X,Y) THEN"

I cannot use "IF TEXTBOX1.LOCATION.X=x AND TEXTBOX1.LOCATION.Y=y THEN"

0

Accepted Solution

altariamx2003 earned 0 total points
ID: 34868148
this is the solution
---------------------------------------------------------------------
DIM NEW_POINT AS NEW SYSTEM.DRAWING.POINT(x,y)

IF TEXTBOX1.LOCATION = NEW_POINT THEN
something....................
---------------------------------------------------------------------
0

LVL 10

Expert Comment

ID: 34868175
If( TextBox1.Location = System.Drawing.Point(X,Y))
{
//code
}
else
{
//code
}

Cheers!
0

LVL 86

Expert Comment

ID: 34868282
You could also write it this way:
``````If TextBox1.Location.Equals(New Point(2, 2)) Then
``````
0

Author Comment

ID: 34868505
himanshut that doesnt work, show the following error: "Point is a drawing type, and it cannot use as an expression

0

Author Comment

ID: 34868507
Idle_Mind

I cannot use your solution in my code

thanks any way
0

LVL 86

Expert Comment

ID: 34868536
No problem...just FYI, you can use Equals() in your example too:

Dim NEW_POINT As New System.Drawing.Point(x, y)
If TextBox1.Location.Equals(NEW_POINT) Then

0

Author Closing Comment

ID: 34895130
this works for my code
0

## Featured Post

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recentâ€¦
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompaâ€¦
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper cornâ€¦
###### Suggested Courses
Course of the Month9 days, 2 hours left to enroll