473,394 Members | 1,759 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,394 software developers and data experts.

array and list box connect?

Hello..I'm almost done with this however. The selectedindex is not recognized and ("c0") is apparently should not be infinity?

Please help I been working on this for a while


Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim strcountries() As String = {"United States", "France"} For intsubsript As Integer = 0 To 1 LstCountries.Items.Add(strcountries(intsubsript)) Next intsubsript

End Sub

Private Sub LstCountries_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LstCountries.SelectedIndexChanged

Dim strcity() As String = {"Washington", "Paris"}

Dim strIndex As String = LstCountries.SelectedIndex txtcity.Text = strcity(strIndex).ToString("co")

End Sub End Class
Apr 9 '12 #1
5 1696
Guido Geurs
767 Expert 512MB
Is this VB6 ?
If not , please place your call in the right forum.
Apr 9 '12 #2
@Guido Geurs
It's actually Visual Basic 2010 but I don't think there's much difference is there?
Apr 9 '12 #3
Guido Geurs
767 Expert 512MB
The syntax of the code is quit different.
In the "Visual Basic.Net" forum are a lot of experts to help you with this code.
Apr 9 '12 #4
thanks for the direction...I reposted in the .NET forum hopefully somebody can help..losing sleep is not my thing.
Apr 9 '12 #5
Expand|Select|Wrap|Line Numbers
  1. 'maybe try this..
  2.  
  3. 'General Declaration
  4. Dim StrCountry(),StrCity() As String
  5.  
  6. 'FormLoad
  7. Redim StrCountry(1)
  8. Redim StrCity(1)
  9. StrCountry() = {"U.S.","France"}
  10. StrCity() = {"Washington","Paris"}
  11. For i = 0 To UBound(StrCountry())
  12. List1.Add StrCountry(i)
  13. Next i
  14.  
  15. 'Listbox Click
  16. Text1.Text = StrCity(List1.SelectedIndex) & "co."
  17.  
Apr 9 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: jonny | last post by:
Hey I need to search an array list to remove duplicate Data The list is populated by a search function that enters in a name if the it is told too This causes duplicate names to be entered...
1
by: Phenix Smith | last post by:
I am looking at coverting an application over to C#. Currently I have a global list varible that needs to be converted. I have tested different ideas to accomplish the same idea. Ths best way I...
13
by: Hrvoje Voda | last post by:
How to put a specified dataset table into an array list ? Hrcko
11
by: Zorpiedoman | last post by:
The problem is this: I have a list box. I set an array list as the datasource. I remove an item from the array list. I set the listbox datasource to nothing. I set the listbox datasource to...
18
by: Doug Bell | last post by:
Hi, I have a function that loads Rows from a field in a DataTable into an ArrayList. See below: It also adds a Row (eg "All Areas"). I wanted this new row to be the first record so I added a...
3
by: Hrvoje Voda | last post by:
DataRow drow = db.dataSetLogo.Logo.Select("LogoName = '" + cPicList.SelectedItem.ToString() + "'"); if (drow.Length > 0) { try {
3
by: Ant | last post by:
Hi, I'm using an array list as the collection for my indexer (_alPeople). When i try to set _alpeople to a value at a certain index, I get an error. I can't simply add the value as it needs to be...
2
by: hannahs | last post by:
I'll try to explain this the best I can. I have a class called book which creates books that each hold information such as author, title, ISBN code, etc. Then I have another class called...
22
by: Energizer100 | last post by:
Hey. I'm having some difficulty in Array lists. I have to find the average of all the numbers in an array list. That's my first task. My second one is to find the mode of all the numbers, meaning the...
3
dlite922
by: dlite922 | last post by:
I have a list of objects, the object has a String and an Int in it. I need to check to see if an item is in the list, if so increment the integer and save it back to the list. I believe I've done...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.