Search This Blog

October 07, 2009

Window Reposition Form VB

Form1.frm


Private Sub setPosition(PForm As Form, CObject As Control)
Form2.Top = PForm.Top + CObject.Top + (CObject.Height * 2) + 55
Form2.Left = PForm.Left + CObject.Left + 55
Form2.Show
PForm.Enabled = False
End Sub

Private Sub Check1_Click()
Call setPosition(Me, Check1)
End Sub

Private Sub Combo1_Click()
Call setPosition(Me, Combo1)
End Sub

Private Sub Command1_Click()
Call setPosition(Me, Command1)
End Sub

Private Sub List1_Click()
Call setPosition(Me, List1)
End Sub

Private Sub Text1_GotFocus()
Call setPosition(Me, Text1)
End Sub

Private Sub Text2_GotFocus()
Call setPosition(Me, Text2)
End Sub

Private Sub Text3_GotFocus()
Call setPosition(Me, Text3)
End Sub

Form2.frm

Private Sub Command1_Click()
Form1.Enabled = True
Form1.Command1.SetFocus
Unload Me
End Sub

No comments: