473,507 Members | 13,917 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting items in listbox

I'm trying to select several items from a listbox. My code is working
except when the form loads the first time. I have the code to select the
items inside sub Initialize_CbLeague. If I call sub Initialize_CbLeague
after the form loads the items are selected correctly. Is there a way to
initialize the listbox after the form as loaded?

I using Vb.net.
Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

Initialize_CbLeague()

End Sub

Thanks
Feb 13 '06 #1
2 1374
Have you tried calling "Initialize_CbLeague" in the Load event handler, or
in the OnLoad override?

--
Tim Wilson
..NET Compact Framework MVP

"miller504" <mi*******@bellsouth.net> wrote in message
news:ey****************@TK2MSFTNGP11.phx.gbl...
I'm trying to select several items from a listbox. My code is working
except when the form loads the first time. I have the code to select the
items inside sub Initialize_CbLeague. If I call sub Initialize_CbLeague
after the form loads the items are selected correctly. Is there a way to
initialize the listbox after the form as loaded?

I using Vb.net.
Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

Initialize_CbLeague()

End Sub

Thanks

Feb 13 '06 #2
The OnLoad override worked. Thanks for the help.

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Have you tried calling "Initialize_CbLeague" in the Load event handler, or
in the OnLoad override?

--
Tim Wilson
.NET Compact Framework MVP

"miller504" <mi*******@bellsouth.net> wrote in message
news:ey****************@TK2MSFTNGP11.phx.gbl...
I'm trying to select several items from a listbox. My code is working
except when the form loads the first time. I have the code to select the
items inside sub Initialize_CbLeague. If I call sub Initialize_CbLeague
after the form loads the items are selected correctly. Is there a way to
initialize the listbox after the form as loaded?

I using Vb.net.
Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

Initialize_CbLeague()

End Sub

Thanks


Feb 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1373
by: Jeffrey Barish | last post by:
I have an application that produces two listboxes. I would like to be able to select one of the items in the first listbox and one of the items in the second listbox. However, when I make my...
5
2317
by: Mark | last post by:
Hi - is it possible to pass a comma delimeted list to a javascript function, which will then loop through the list, and check against a listboxs items, and if the value in the list, corresponds to...
1
3392
by: Bob Geltz | last post by:
I am able to populate a ListView with several detail lines (several columns). When finished, I would like to pre-select the first item in the list (before the user interacts with the list). This...
4
9696
by: Paddy | last post by:
How do I select a subitem from a listview after clicking on the first column? Couldn't find it in MSDN. Thank you. Paddy.
6
6493
by: Valerian John | last post by:
I have a ListBox webcontrol on an aspx page. Items are added to the ListBox using client-side code. However, when the page is posted back the items are missing/not available. (It is like the...
4
11475
by: Ron | last post by:
I've got a listbox that holds a list of groups. Users can select a group, hit the remove button and the group should be removed from the listbox. The only problem is that no matter which group you...
3
41894
by: Jonesgj | last post by:
Chaps, How would I select all items in a listbox using code? I'm sure its an easy one but .... Thanks
4
17379
by: John | last post by:
Hi there, I'm just starting at VB.NET (all VB come to that), and have what's probably a very basic question: I have a form in Visual Studio 2003 that has a listbox that is meant to be...
4
2075
by: Duncan Smith | last post by:
So far, the quikest way I have found to select all items in a list box is to turn off updates, set a wait cusror and then call SetSelected on each item (see below), but it's too slow when the...
0
7221
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.