468,272 Members | 2,041 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

late binding error

Is there any way to avoid the late binding error in this code snippet? Opton
Strict ON
Public Sub ComboBoxFlatClearForEdit(ByRef obj As Object)

Dim objControl As New Control

For Each objControl In obj.Controls ' (LATE BINDING ERROR)

ComboBoxFlatEmpty(objControl)

Next

End Sub

Thanks,

Dean Slindee

Nov 21 '05 #1
3 1298
"Dean Slindee" <sl*****@charter.net> schrieb:
Is there any way to avoid the late binding error in this code snippet?
Opton
Strict ON
Public Sub ComboBoxFlatClearForEdit(ByRef obj As Object)
'ByRef obj As Object' => 'ByVal obj As Control'.
Dim objControl As New Control
Remove the 'As New Control', it doesn't make sense here.
For Each objControl In obj.Controls ' (LATE BINDING ERROR)


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
can you give more information please -- what is obj?

Nov 21 '05 #3
Recoded as below and now is not a late bind. The change is to say "ByRef
obj As Control"
Public Sub ComboBoxFlatClearForEdit(ByRef obj As Control)

Dim ctl As New Control

For Each ctl In obj.Controls

ComboBoxFlatEmpty(ctl)

Next

End Sub

"Dean Slindee" <sl*****@charter.net> wrote in message
news:xD*******************@fe04.lga...
Is there any way to avoid the late binding error in this code snippet? Opton Strict ON
Public Sub ComboBoxFlatClearForEdit(ByRef obj As Object)

Dim objControl As New Control

For Each objControl In obj.Controls ' (LATE BINDING ERROR)

ComboBoxFlatEmpty(objControl)

Next

End Sub

Thanks,

Dean Slindee

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by VB Programmer | last post: by
5 posts views Thread by eBob.com | last post: by
30 posts views Thread by lgbjr | last post: by
1 post views Thread by Dean Slindee | last post: by
2 posts views Thread by Dean Slindee | last post: by
2 posts views Thread by Dean Slindee | last post: by
14 posts views Thread by Siv | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.