-
ByRef argument type mismatch
[Originally posted by Alex]
I have an array of buttons and for this I use
Public Sub UpdateButtons(Optional blockEm As Variant)
'
'
'
End Sub
Public Sub NavigateButtons(sButtonString As String)
'
'
'
End Sub
Public Sub LockTheControls(bLocked As Variant) 'Boolean
Dim iIndx As Integer
With Screen.ActiveForm
For iIndx = 0 To .Controls.Count - 1
˙ ˙ If (.Controls(iIndx).Tag = "1") Then
˙ ˙ ˙ ˙ If (TypeOf .Controls(iIndx) Is TextBox) Then
˙ ˙ ˙ ˙ ˙ ˙ If (bLocked) Then
˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ .Controls(iIndx).Locked = True
˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ .Controls(iIndx).BackColor = vbWhite
˙ ˙ ˙ ˙ ˙ ˙ Else
˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ .Controls(iIndx).Locked = False
˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ .Controls(iIndx).BackColor = vbYellow
˙ ˙ ˙ ˙ ˙ ˙ End If
˙ ˙ ˙ ˙ End If
˙ ˙ End If
Next
End With
End Sub
So if I declare parameter bLocked as Boolean
Public Sub LockTheControls(bLocked As Boolean)
there is "Compile error: ByRef argument type mismatch"
But when
I declare parameter bLocked as Variant
there is no error
Why this happen
Please help me
If there is any help I appreciate it
-
Re:ByRef argument type mismatch
[Originally posted by FreeVBCode.com]
The error is probably in whatever code is calling LockTheControls.˙ You are probably passing a non-boolean value to it.
-
Re:ByRef argument type mismatch
[Originally posted by Angchuk]
Since u dodnot return or modifying the value of bLocked in the Public Sub LockTheControls(bLocked As Boolean)
try declaring like this:
Public Sub LockTheControls(ByVal bLocked As Boolean)
OR:
Check if bLocked is declared as Boolean in the caller function.
For example if u have declared bLocked˙ like this
Dim bLocked, exTestBoolean As Boolean 'Where exTestBoolean is an another boolean variable
The try declaring like this
Dim bLocked As Boolean, exTestBoolean As Boolean 'Where exTestBoolean is an another boolean variable
Drop a line if its :-)˙ or even if its :-(
-
Re:Re:ByRef argument type mismatch
[Originally posted by Alex]
O, yes thanks a lot.It was my fault
I declared as you told me to do now there is no error
Public Sub LockTheControls(ByVal bLocked As Boolean)
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks