1

This is my code to lock controls in VB6

Private Function lockControls()
    For Each ctrl In Me.Controls
        If TypeOf ctrl Is TextBox _
        Or TypeOf ctrl Is ComboBox _
        Or TypeOf ctrl Is NumBox _
        Or TypeOf ctrl Is OptionButton _
        Or TypeOf ctrl Is DTPicker Then
            ctrl.Enabled = True
        End If
    Next
End Function

But when I try to run the program it is showing type mismatch and is not giving any hint.
Can anyone say what is wrong in this code.

2 Answers 2

1

VB6 has a hidden property LockControls that controls locking controls on the form. Your function name, lockControls, conflicts with it.

Rename the function.

Sign up to request clarification or add additional context in comments.

Comments

0

If you're receiving the error:

error DATA TYPE MISMATCH in FUNCTION OBJECT "FUNCTION1"

Go to your mdb file and change the datatype of your fields.

1 Comment

go to datasheet then select data type and choose number.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.