-
August 4th, 2013, 02:27 PM
#1
Custom Save button finding parent form it resides on
I am using VB 2010.
I wanted to put the code below into a save custom control. The problem is that how do I get a command button custom control to recognize the form that the save button custom control sits on? Is it possible to have the code below in a button custom class. If so it would be good because the company will have a "universal save checking" as a default behavior. And our checking occurs when the user leaves the control.
Code:
Dim ctrl As Control = Me.GetNextControl(Me, True) 'Get the first control in the tab order.
Do Until ctrl Is Nothing 'Use ctrl here.
If (TypeOf ctrl Is clsTextBox) Then
Dim mtb As clsTextBox = CType(ctrl, clsTextBox)
mtb.Focus()
SendKeys.SendWait("{TAB}")
If Not mtb.IsValidated Then
mtb.Focus()
Exit Do
End If
End If
ctrl = Me.GetNextControl(ctrl, True) 'Get the next control in the tab order.
Loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|