473,569 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determing the ordinal position of items in ListBox

Hi

I have a ListBox called lstListOfStuff

I want to get the ordinal position of a ListItem so that I can insert a new
ListItem below it. How do I do this? I cannot find any members to give me
the index position of an item?

Thanks,

S
Nov 15 '05 #1
3 8992
i hope this is what you need.

listBox1.Select edIndex --> get selected item's index
listBox1.Items[0] --> access each item
listBox1.Items. Count --> get item count

hope this helps

--
gani
pls visit http://thedeveloperscorner.com.ph

"SamIAm" <sa****@rubbach icken.com> wrote in message
news:O1******** ******@tk2msftn gp13.phx.gbl...
Hi

I have a ListBox called lstListOfStuff

I want to get the ordinal position of a ListItem so that I can insert a new ListItem below it. How do I do this? I cannot find any members to give me
the index position of an item?

Thanks,

S

Nov 15 '05 #2
Use the IndexOf property

int indx = ListBox.Items IndexOf(ListBox .Items.FindItem ByValue('my_val ue');
"SamIAm" <sa****@rubbach icken.com> wrote in message
news:O1******** ******@tk2msftn gp13.phx.gbl...
Hi

I have a ListBox called lstListOfStuff

I want to get the ordinal position of a ListItem so that I can insert a new ListItem below it. How do I do this? I cannot find any members to give me
the index position of an item?

Thanks,

S

Nov 15 '05 #3
Thanks for the reply gani

I am aware of those members. I am trying to determine the index of a
particular item i.e.
ListItem foundItem = listBox1.items. FindByValue("so meValue");
no that I have the item how do I determine its position in the ListBox. How
do I insert a new item just after it?

Hope that is clear,

S

"gani" <a@a.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
i hope this is what you need.

listBox1.Select edIndex --> get selected item's index
listBox1.Items[0] --> access each item
listBox1.Items. Count --> get item count

hope this helps

--
gani
pls visit http://thedeveloperscorner.com.ph

"SamIAm" <sa****@rubbach icken.com> wrote in message
news:O1******** ******@tk2msftn gp13.phx.gbl...
Hi

I have a ListBox called lstListOfStuff

I want to get the ordinal position of a ListItem so that I can insert a

new
ListItem below it. How do I do this? I cannot find any members to give me the index position of an item?

Thanks,

S


Nov 15 '05 #4

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

Similar topics

3
19565
by: darren | last post by:
How, using asp.net (vb.net), can I remove multiple selected items from a listbox. Everything I try does not seem to work. Thanks in advance.
1
5631
by: Jim Geissman | last post by:
Is there a neat way to find an ordinal value from a table, for example the median or 95th percentile value in a column, without walking through the table in ascending or descending order? Thanks, Jim Geissman Countrywide Home Loans
14
21900
by: Zenobia | last post by:
Hello folks, Is it possible to position an item within a <td> element? For instance see below. The table has multiple rows, one for each database record. Each row has 3 hrefs associated with it (for edit, delete and update). I want to position these 3 href items in the same columns, which would be posible if the span could be positioned -...
1
1441
by: SamIAm | last post by:
Hi I have a ListBox called lstListOfStuff I want to get the ordinal position of a ListItem so that I can insert a new ListItem below it. How do I do this? I cannot find any members to give me the index position of an item? Thanks,
24
8473
by: Donald Grove | last post by:
I want to populate an array with values from an ado recordset (multiple rows) I use the absolute position of the cursor in the recordset to define the row of my array to be populated. I have a workaround for lack of a way to define the ordinal position of a field (incrementing a counter variable), but it feels so primitive: dim Fld as...
5
3584
by: Randy | last post by:
Hi, I'm have a form with a listbox and a few textboxes on it. Based on the user's selection in the listbox, I want the bindingsource to update the textboxes with the corresponding values. I have similar code built for a combobox that works just fine, but when applying it to a listbox bound to a dataview, I can't figure out how to return the...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2117
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 we have to send another system
1
1228
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.