Hi,

I am working in an application that uses Drag & Drop in VB6, and I need to determine which type of control is the user dragging.
I have in the form several controls: PictureBox, TextBox and ListBox.
I know that I can use TypeOf() in VB .Net, but, what can I use in VB6?

Thanks in advance!

Dim ctl As Control
For Each ctl In Me.Controls
    If TypeOf ctl Is TextBox Then
    'do something
    ElseIf TypeOf ctl Is ComboBox Then
    'do seomething
    else
    'do something
    End If
Next ctl

Thanks!
I was using something like this:

If TypeOf (ctl) Is TextBox Then
    ...
End If

The problem is with "(" and ")". It doesnt work in VB6.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.