Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » .NET Programming (VB 2010 or earlier) » Visual Basic .NET » Location


LocationExpand / Collapse
Author
Message
Posted 6/25/2009 2:30:33 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/25/2009 1:58:35 PM
Posts: 1, Visits: 1
Hey, I'm trying to make a Form pop up at an random place (given in a textbox)

Here is my code so far:

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Form2.Location = Textbox1.text
Form2.Visible = True End Sub


Yes i know it doesn't work

What I really need to know is how to make the txt understandeble for the system.drawing.point.

Thank you for all replies
Post #27837
Posted 6/30/2009 9:42:30 AM


Forum God

Forum GodForum GodForum GodForum GodForum GodForum GodForum GodForum God

Group: Forum Members
Last Login: 9/7/2010 12:29:54 PM
Posts: 633, Visits: 1,019
Create a new instance of a point:

Dim pt As New Point(x,y)

or something similar. X and Y are the two integers that define the point. You can use text boxes to allow the user to set the values of x and y, then bind them to this point after that, just be careful to restrict them to use only integers. Use the CInt() method for that. Then, just set Form1.Location to this point.



-Mobius

Post #27860
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 10:50pm