Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Respected Sir,

i have been developing windows application using vb.net..
here i have one window on which i have one button ..on click event of that button i want to open/show another form just beside of that button...
for eg...
frm.Left = Me.txtSearch.Left + 10



Just help me..

Thank you...
Posted

You first need to create the form before you can reference it and set properties of it. Have a look here:
http://www.dummies.com/how-to/content/opening-closing-and-hiding-forms-with-visual-basic.html[^]

Good luck!
 
Share this answer
 
Comments
Sunil Bansode 2-Jul-12 7:13am    
Thank you sir for reply..
but i want to show that form just exactly beside of that button only..from your suggestion i have tried it but that form is opening anywhere on the screen...
E.F. Nijboer 2-Jul-12 9:53am    
That is correct, but before you show the form you can set the left property like you tried before. But because you now have an actual instance it won't give you an exception. Try squeezing the line in ;-)
Try this

VB
Private Sub myButton_Click(sender As Object, e As EventArgs)
    Dim childForm = New childFormClassName()
    childForm.Location = Me.PointToScreen(myButton.Location)
    childForm.StartPosition = FormStartPosition.Manual
    childForm.Show()
End Sub



Mark it as solution if it answers you question
 
Share this answer
 
Comments
Sunil Bansode 2-Jul-12 8:28am    
Thanks a lot dear...its working....
Shemeer NS 2-Jul-12 10:16am    
you are welcome.... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900