ListBox selection  
Author Message
JakeHornwwwmscrmexpertscom





PostPosted: Sat Feb 18 20:47:43 CST 2006 Top

Visual Basic >> ListBox selection I have several list boxes on a form. I want to fill the first one at run
time, and based on the user's selection from that list box, fill the second
one, and so on. If there is only one item in a list box, I want the program
to select that item automatically and move on to the next list box. How do I
get the program to do this (i.e. simulate the Click event for that list box)?

Dan

Visual Studio96  
 
 
JP





PostPosted: Sat Feb 18 20:47:43 CST 2006 Top

Visual Basic >> ListBox selection If you have "AddItem code" in List1 then see below

Private Sub Form_Load()
'Code can also be put in function that populates list1
If List1.ListCount = 1 Then
List1.Selected(0) = True
End If
'This will trigger List1_click event to fire
End Sub

Private Sub List1_Click()
List2.AddItem List1.Text
End Sub

"Dan" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> I have several list boxes on a form. I want to fill the first one at run
> time, and based on the user's selection from that list box, fill the
second
> one, and so on. If there is only one item in a list box, I want the
program
> to select that item automatically and move on to the next list box. How do
I
> get the program to do this (i.e. simulate the Click event for that list
box)?
>
> Dan


 
 
JP





PostPosted: Sat Feb 18 20:51:38 CST 2006 Top

Visual Basic >> ListBox selection meant to say if you have "addItem code" in List1_Click event

"JP Bless" <EMail@HideDomain.com> wrote in message
news:EMail@HideDomain.com...
> If you have "AddItem code" in List1 then see below
>
> Private Sub Form_Load()
> 'Code can also be put in function that populates list1
> If List1.ListCount = 1 Then
> List1.Selected(0) = True
> End If
> 'This will trigger List1_click event to fire
> End Sub
>
> Private Sub List1_Click()
> List2.AddItem List1.Text
> End Sub
>
> "Dan" <EMail@HideDomain.com> wrote in message
> news:EMail@HideDomain.com...
> > I have several list boxes on a form. I want to fill the first one at run
> > time, and based on the user's selection from that list box, fill the
> second
> > one, and so on. If there is only one item in a list box, I want the
> program
> > to select that item automatically and move on to the next list box. How
do
> I
> > get the program to do this (i.e. simulate the Click event for that list
> box)?
> >
> > Dan
>
>


 
 
Dan





PostPosted: Sun Feb 19 17:18:27 CST 2006 Top

Visual Basic >> ListBox selection Thank you. That's what I was looking for.

Dan

"JP Bless" wrote:

> meant to say if you have "addItem code" in List1_Click event
>
> "JP Bless" <EMail@HideDomain.com> wrote in message
> news:EMail@HideDomain.com...
> > If you have "AddItem code" in List1 then see below
> >
> > Private Sub Form_Load()
> > 'Code can also be put in function that populates list1
> > If List1.ListCount = 1 Then
> > List1.Selected(0) = True
> > End If
> > 'This will trigger List1_click event to fire
> > End Sub
> >
> > Private Sub List1_Click()
> > List2.AddItem List1.Text
> > End Sub
> >
> > "Dan" <EMail@HideDomain.com> wrote in message
> > news:EMail@HideDomain.com...
> > > I have several list boxes on a form. I want to fill the first one at run
> > > time, and based on the user's selection from that list box, fill the
> > second
> > > one, and so on. If there is only one item in a list box, I want the
> > program
> > > to select that item automatically and move on to the next list box. How
> do
> > I
> > > get the program to do this (i.e. simulate the Click event for that list
> > box)?
> > >
> > > Dan
> >
> >
>
>
>