سورس Blank and Lock-Unlock Form Input Controls ویژوال بیسیک

 سورس Blank and Lock-Unlock Form Input Controls ویژوال بیسیک

Public Sub BlankFields(oForm As Form)
'*** NOTE THE COMMENTED OUT CODE REFERS TO CONTROLS THAT
'*** REQUIRE YOU TO ADD THEM FROM THE PROJECT | COMPONENTS
'*** MENU.  IF YOU HAVE THESE CONTROLS IN YOUR PROJECT, YOU
'*** CAN COMMENT THEM BACK IN

    Dim myControl As Control
    
    For Each myControl In oForm.Controls
        If TypeOf myControl Is CheckBox Then
            myControl.Value = vbUnchecked
        ElseIf TypeOf myControl Is TextBox Then
            myControl.Text = ""
        'ElseIf TypeOf myControl Is RichTextBox Then
        '    myControl.Text = ""
        
        End If
    Next
End Sub
Public Sub New_LockObjects(oForm As Form, bLock As Boolean)

'*** NOTE THE COMMENTED OUT CODE REFERS TO CONTROLS THAT
'*** REQUIRE YOU TO ADD THEM FROM THE PROJECT | COMPONENTS
'*** MENU.  IF YOU HAVE THESE CONTROLS IN YOUR PROJECT, YOU
'*** CAN COMMENT THEM BACK IN
   
    Dim myControl As Control
    
    If bLock = True Then        ' Save or Undo Called
        
        For Each myControl In oForm.Controls
            If TypeOf myControl Is CommandButton Then
                'Optional
                myControl.Enabled = False

            ElseIf TypeOf myControl Is CheckBox Then
                myControl.Enabled = False
            ElseIf TypeOf myControl Is OptionButton Then
                myControl.Enabled = False
            ElseIf TypeOf myControl Is TextBox Then
                myControl.Locked = True
            'ElseIf TypeOf myControl Is DataCombo Then
             '   myControl.Locked = True
            ElseIf TypeOf myControl Is ComboBox Then
                myControl.Locked = True
            ElseIf TypeOf myControl Is UserControl Then
                If myControl.Name = "uctlbNavigation1" Then
                    oForm.uctlbNavigation1.EnableButtons
                End If
            End If
        Next

    Else        ' Edit or Add Called
    
        For Each myControl In oForm.Controls
            If TypeOf myControl Is CommandButton Then
                'Optional
                myControl.Enabled = True

            ElseIf TypeOf myControl Is CheckBox Then
                myControl.Enabled = True
            ElseIf TypeOf myControl Is OptionButton Then
                myControl.Enabled = True
            ElseIf TypeOf myControl Is TextBox Then
                myControl.Locked = False
            'ElseIf TypeOf myControl Is DataCombo Then
            '    myControl.Locked = False
            ElseIf TypeOf myControl Is ComboBox Then
                myControl.Locked = False
            End If
        Next
    
    End If


End Sub

تماس با گیل دیتا تماس با گیل دیتا تماس با گیل دیتا تماس با گیل دیتا

مطالب مشابه


2019 © تمامی حقوق این وب‌سایت برای گیل دیتا محفوظ است.
انصراف
پشتیبانی آنلاین