Listbox Counting help
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
hello I need to count through a listbox and make it select an item soo say I have 100 enteries in the listbox and I need to find what enterie number 34 is how would I make it work that out please I already have set up a system to predict the amount it needs to count and total amount of people in the listbox its self just need this bit done now :P
Code: Select all
calling:
Function GetItemByID(ByVal no As Integer)
Dim Item As String = ListBox1.Items(no - 1) 'Declares string item which is equal to item on no place in listbox (since index starts from 0 not from 1, no must be substracted by 1)'
Return Item 'Returns Text on no place'
End Function
Code: Select all
Textbox1.text = GetItemByID(12)
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo![]()
I tired that and it says that it is not a valid index :( I also tried playing round with it and no matter what way I changed it + - whatever allways was not a valid index
Try
Code: Select all
Dim Item As String = ListBox1.Items(no - 1).ToString
CodenStuff wrote:Nope, it's just your sick and dirty mind. You sick twisted warped little pervo![]()
it is small stupid thing xD easily change it to
Code: Select all
edit: my bad didn't see it is listBOX...
dim str As string =listview1.items(number between 0 and itemcount-1 ).TEXT
Code: Select all
For i as integer =0 to listbox1.items.count - 1
if listbox1.items(i) = 34 then msgbox(i.tostring)
next
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023