473,473 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ListBox SelectionMode

Hi All,

I've got a listbox on a VB.NET form. when the form opens, the ListBox
SelectionMode is set to Single. while running various routines on the form,
items get added to the list box (results of computations, etc).

when all of the calculations are complete, I'm trying to change the listbox
selection mode from single to MultiExtended, using:

myListBox.SelectionMode=SelectionMode.MultiExtende d

However, it's not working. I can still only select one item.

By the way, the reason I start with the listbox selection mode set to single
is that as items are added to the listbox, I always have the last item
selected:

myListBox.SelectedIndex=myListbox.Items.Count-1

this way, as items are added, the list automatically scrolls, so the latest
information is always visible.

But, when the calcs are finished, I want the user to be able to select
whatever they want and copy/paste elsewhere, which is why I'm trying to
switch to MultiExtended

Also, by the way, if I start with the SelectionMode set to MultiExtended, I
can select multiple items, so it's only switching from one to the other that
isn't working.

Any Ideas?

tia
Lee
Nov 21 '05 #1
4 5020
CT
I have no problems doing that here, in a Windows Form. Are you talking about
a Web page?

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"lgbjr" <lg***@nospam.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi All,

I've got a listbox on a VB.NET form. when the form opens, the ListBox
SelectionMode is set to Single. while running various routines on the
form, items get added to the list box (results of computations, etc).

when all of the calculations are complete, I'm trying to change the
listbox selection mode from single to MultiExtended, using:

myListBox.SelectionMode=SelectionMode.MultiExtende d

However, it's not working. I can still only select one item.

By the way, the reason I start with the listbox selection mode set to
single is that as items are added to the listbox, I always have the last
item selected:

myListBox.SelectedIndex=myListbox.Items.Count-1

this way, as items are added, the list automatically scrolls, so the
latest information is always visible.

But, when the calcs are finished, I want the user to be able to select
whatever they want and copy/paste elsewhere, which is why I'm trying to
switch to MultiExtended

Also, by the way, if I start with the SelectionMode set to MultiExtended,
I can select multiple items, so it's only switching from one to the other
that isn't working.

Any Ideas?

tia
Lee

Nov 21 '05 #2
No, it's a windows form (specifically, it's an MDI Child form). Setting the
SelectionMode at design time works fine, but trying to change it at runtime
is just being ignored (no exception, nothing)

On another list, someone said they thought the SelectionMode was a
designtime only property (which is the way it's acting), but I'd expect a
build error or an exception if that were the case.

Lee

"CT" <ca******@spammersgoawayintegrasol.dk> wrote in message
news:ev**************@tk2msftngp13.phx.gbl...
I have no problems doing that here, in a Windows Form. Are you talking
about a Web page?

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"lgbjr" <lg***@nospam.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi All,

I've got a listbox on a VB.NET form. when the form opens, the ListBox
SelectionMode is set to Single. while running various routines on the
form, items get added to the list box (results of computations, etc).

when all of the calculations are complete, I'm trying to change the
listbox selection mode from single to MultiExtended, using:

myListBox.SelectionMode=SelectionMode.MultiExtende d

However, it's not working. I can still only select one item.

By the way, the reason I start with the listbox selection mode set to
single is that as items are added to the listbox, I always have the last
item selected:

myListBox.SelectedIndex=myListbox.Items.Count-1

this way, as items are added, the list automatically scrolls, so the
latest information is always visible.

But, when the calcs are finished, I want the user to be able to select
whatever they want and copy/paste elsewhere, which is why I'm trying to
switch to MultiExtended

Also, by the way, if I start with the SelectionMode set to MultiExtended,
I can select multiple items, so it's only switching from one to the other
that isn't working.

Any Ideas?

tia
Lee


Nov 21 '05 #3
CT
Hi Lee,

Not at all sure why you're experincing this, as the SelectionMode property
is not a design-time only property, i.e. read-only at run-time. After you
set the property, what is it set to, if you read it? You're not by any
chance trying to update the property from a background thread?

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"lgbjr" <lg***@nospam.com> wrote in message
news:uO****************@tk2msftngp13.phx.gbl...
No, it's a windows form (specifically, it's an MDI Child form). Setting
the SelectionMode at design time works fine, but trying to change it at
runtime is just being ignored (no exception, nothing)

On another list, someone said they thought the SelectionMode was a
designtime only property (which is the way it's acting), but I'd expect a
build error or an exception if that were the case.

Lee

"CT" <ca******@spammersgoawayintegrasol.dk> wrote in message
news:ev**************@tk2msftngp13.phx.gbl...
I have no problems doing that here, in a Windows Form. Are you talking
about a Web page?

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"lgbjr" <lg***@nospam.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi All,

I've got a listbox on a VB.NET form. when the form opens, the ListBox
SelectionMode is set to Single. while running various routines on the
form, items get added to the list box (results of computations, etc).

when all of the calculations are complete, I'm trying to change the
listbox selection mode from single to MultiExtended, using:

myListBox.SelectionMode=SelectionMode.MultiExtende d

However, it's not working. I can still only select one item.

By the way, the reason I start with the listbox selection mode set to
single is that as items are added to the listbox, I always have the last
item selected:

myListBox.SelectedIndex=myListbox.Items.Count-1

this way, as items are added, the list automatically scrolls, so the
latest information is always visible.

But, when the calcs are finished, I want the user to be able to select
whatever they want and copy/paste elsewhere, which is why I'm trying to
switch to MultiExtended

Also, by the way, if I start with the SelectionMode set to
MultiExtended, I can select multiple items, so it's only switching from
one to the other that isn't working.

Any Ideas?

tia
Lee



Nov 21 '05 #4
LOL! Well, I'm not sure why I was having problems either. I was checking
that the SelectionMode was actually being set to MultiExtended, yet the
control was still acting like it was set to one.

However, and I sware it was really happening, it's not happening now. Not
because of this issue, but I have rebooted the machine, but I don't know if
that's what fixed the problem (not likely). I just tried switching from one
to Multi and from multi to one and it works.

I switched the SelectionMode at designtime to MultiExtended, then just put a
listbox.clearselected after each item I added, then I select the last item.

I don't have time right now, but later today, I'm going to comment out
everything I added and set the designtime selectionmode back to one, then
try to reproduce the problem (just for my own sanity).

cheers,
Lee

"CT" <ca******@spammersgoawayintegrasol.dk> wrote in message
news:uM****************@TK2MSFTNGP12.phx.gbl...
Hi Lee,

Not at all sure why you're experincing this, as the SelectionMode property
is not a design-time only property, i.e. read-only at run-time. After you
set the property, what is it set to, if you read it? You're not by any
chance trying to update the property from a background thread?

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"lgbjr" <lg***@nospam.com> wrote in message
news:uO****************@tk2msftngp13.phx.gbl...
No, it's a windows form (specifically, it's an MDI Child form). Setting
the SelectionMode at design time works fine, but trying to change it at
runtime is just being ignored (no exception, nothing)

On another list, someone said they thought the SelectionMode was a
designtime only property (which is the way it's acting), but I'd expect a
build error or an exception if that were the case.

Lee

"CT" <ca******@spammersgoawayintegrasol.dk> wrote in message
news:ev**************@tk2msftngp13.phx.gbl...
I have no problems doing that here, in a Windows Form. Are you talking
about a Web page?

--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"lgbjr" <lg***@nospam.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi All,

I've got a listbox on a VB.NET form. when the form opens, the ListBox
SelectionMode is set to Single. while running various routines on the
form, items get added to the list box (results of computations, etc).

when all of the calculations are complete, I'm trying to change the
listbox selection mode from single to MultiExtended, using:

myListBox.SelectionMode=SelectionMode.MultiExtende d

However, it's not working. I can still only select one item.

By the way, the reason I start with the listbox selection mode set to
single is that as items are added to the listbox, I always have the
last item selected:

myListBox.SelectedIndex=myListbox.Items.Count-1

this way, as items are added, the list automatically scrolls, so the
latest information is always visible.

But, when the calcs are finished, I want the user to be able to select
whatever they want and copy/paste elsewhere, which is why I'm trying to
switch to MultiExtended

Also, by the way, if I start with the SelectionMode set to
MultiExtended, I can select multiple items, so it's only switching from
one to the other that isn't working.

Any Ideas?

tia
Lee



Nov 21 '05 #5

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

Similar topics

2
by: Fieldmedic | last post by:
I'm attempting to get an arraylist to display in a Listbox (listbox2). The arraylist is created from selections in a different listbox (listbox1). The 1st listbox has a selection mode of...
9
by: Alpha | last post by:
Hi, How can I set all the items in a listbox to be selected? I can't find a property or mehtod to do it so I thought I'll try using setselected method but I need to find out how many items are in...
3
by: ted | last post by:
Hi, I can't figure out how to set multiple items in a ListBox to selected when the listbox is in a User Control. When the ListBox is set in directly into a form I can use the following:...
6
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset...
2
by: tangokilo | last post by:
Hello and thanks for your help, I have the following Listbox created in VisualStudio 2003 designer, desiring to select multiple entries from that list: -------------------------------...
18
by: Dave Sauny | last post by:
Ok, its a friday, I'm at work and I cant get this to work: I have 3 listboxes on one tab control page. when i select an item in listbox1 i want whatever is selected on the other 2 listboxes...
0
by: **Developer** | last post by:
Has anyone found out how to do DragDrop from a ListBox with SelectionMode.MultiExtended I've been searching Google and see that it is an old problem. I know from past experience that it stems...
5
by: chad | last post by:
Hi, Im new to C#, and I have a question. I can't figure out how to set the listbox control top select multiple items in a ListBox. I have tried using the following code, but C# VS 2005 PE...
0
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a ListBox server control named "lb_dates" with a SelectionMode of "Multiple". The user can select multiple dates from the listbox. I have ObjectDataSource named "ods_rfq" with a...
0
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.