Thursday, February 21, 2013

2/21/2013


Get access to the control by control name.

Dim ControlName As String = sender.name
Dim returnValue() As Control
mySelectedAddress = New Address.AddressVerify


 returnValue = Me.Controls.Find("txtSelAddress" & ControlName.Substring(ControlName.Length - 1, 1), True)

For Each C As Control In returnValue
            mySelectedAddress.AddressLine1 = C.Text
Next

 

Loop Thru to check the Control Type

 For Each Control As Control In Me.Controls
            If Control.GetType.ToString = "System.Windows.Forms.TextBox" Then
                CType(Control, TextBox).ReadOnly = False
            End If
Next

For Each Control As Control In Me.Controls
            If TypeOf Control Is TextBox Then
                CType(Control, TextBox).ReadOnly = False
            End If
Next

 

No comments:

Post a Comment