473,396 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

last seleced item of listbox

Hei
Hi,

When a listbox SelectionMode set to MultiSimple, how can i know the last
selected item?

thx
Hei
Nov 20 '05 #1
2 1411
Cor
Hi Hei,

Here an example with all some questions in one
\\\
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Me.ListBox1.SelectionMode = SelectionMode.MultiSimple
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim i As Integer
Dim b As String
Me.ListBox1.SelectionMode = SelectionMode.MultiSimple
For i = 0 To ListBox1.SelectedItems.Count - 1
b = b & ListBox1.SelectedItems(i).ToString & " "
Next
MessageBox.Show(b)
End Sub
///

I hope this helps a little bit?

Cor
Nov 20 '05 #2
Hei
hi Cor,

i have try these code, it is very interest of selecteditems, it items is
sorted. So, when user select form top to bottom is fine, therwise
....

:-)
Hei
"Cor" <no*@non.com> wrote in message
news:ue**************@TK2MSFTNGP09.phx.gbl...
Hi Hei,

Here an example with all some questions in one
\\\
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ListBox1.SelectionMode = SelectionMode.MultiSimple
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim i As Integer
Dim b As String
Me.ListBox1.SelectionMode = SelectionMode.MultiSimple
For i = 0 To ListBox1.SelectedItems.Count - 1
b = b & ListBox1.SelectedItems(i).ToString & " "
Next
MessageBox.Show(b)
End Sub
///

I hope this helps a little bit?

Cor

Nov 20 '05 #3

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

Similar topics

1
by: Pieter | last post by:
Hi, I'm adding hundreds of strings to a listbox and I want the last added string to be visable to the user. In C++ there is a function SetTopIndex which does this, how do you do it in VB? ...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
2
by: Peder Y | last post by:
Anyone knows if there is some kind of property or function that will return the last selected/deselected item/index in a multiselect ListBox? SelectedIndex will point to first index in the...
5
by: GG | last post by:
I know I can scroll to the last item in the listbox by calling SetSelected all the time What I need is when I add items through the Items.Add or Items.AddRange to be called automatically and go...
1
by: jez123456 | last post by:
Hi, I have a windows form with a listbox control. My code all works correctly when deleting an item from the listbox except the last item. I get the following message when trying to delete the...
1
by: Karen Grube | last post by:
Hi! I'm using a standard server side ASP.Net listbox control on a web form. The page is basically various shades of green. The listbox itself has a pale green background and forest green text...
5
by: John Veldthuis | last post by:
My code works perfectly 100% when adding items to my ArrayList and updating the listbox. Works perfectly when deleting an item in the ArrayList when it is not the last entry but if it is the last...
3
by: Kevin Walzer | last post by:
I'm trying to set the active item in a Tkinter listbox to my application's currently-defined default font. Here's how I get the fonts loaded into the listbox: ...
0
by: inandout | last post by:
Hi, I was wondering if anyone can help me with this. I have a listview that is specified to a size of: 348W x 308H When items are added to it, no problems. However when items continue to be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.