DBListboxes

Hi,

I am a new VB programmer and am stuck on a simple problem

which I can't seem to get the syntax correct on a program I am working on. I have 2 DBList boxes in VB6.0

which are related. One has a list of names and the other DBListbox has a value for the corresponding name.

I am trying to allow a user to select a name with the mouse in one DBList box and have the corresponding

value also be selected(highlighted) in the other Listbox. I have used an if statement like this :

If DBList1.selected(1) = true then

DBList2.selected(1) = true

end if

I just can't seem to get it right. If you can help, I would appreciate it.

Thanks, Sandy MacDonald


Comments

  • : Hi,

    : I am a new VB programmer and am stuck on a simple problem

    : which I can't seem to get the syntax correct on a program I am working on. I have 2 DBList boxes in VB6.0

    : which are related. One has a list of names and the other DBListbox has a value for the corresponding name.

    : I am trying to allow a user to select a name with the mouse in one DBList box and have the corresponding

    : value also be selected(highlighted) in the other Listbox. I have used an if statement like this :

    : If DBList1.selected(1) = true then

    : DBList2.selected(1) = true

    : end if

    : I just can't seem to get it right. If you can help, I would appreciate it.

    : Thanks, Sandy MacDonald


    How about something like this:


    Private Sub DBList1_Click()

    Dim x As Integer

    For x = 1 To 20 'Fit to your situation

    If DBList1.Selected(x) Then

    DBList2.Selected(x) = True

    Exit Sub

    End If

    Next

    End Sub


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories