473,396 Members | 1,879 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.

1-demensional array string cannot be converted to integer

11
i am doing an assignment in vb.net. i have to select at random from and array what i have is

dim country(29) as string
dim random as new random

txtcountry.text = random.next(country)

I keep getting that this error
1-demensional array string cannot be converted to integer

can anyone help?

thanks
Mar 16 '07 #1
4 1476
markmcgookin
648 Expert 512MB
i am doing an assignment in vb.net. i have to select at random from and array what i have is

dim country(29) as string
dim random as new random

txtcountry.text = random.next(country)

I keep getting that this error
1-demensional array string cannot be converted to integer

can anyone help?

thanks
Dim randomNo as Int

...

randomNo = toInt(random)

txtcountry.text = randomNo(country)

?? would that work?
Mar 16 '07 #2
spud379
11
No it didn't work but thanks anyway
Mar 16 '07 #3
willakawill
1,646 1GB
When you create a random number between 0 and 28 you can then use it as an array index to select a random string. The index is the part in brackets so you need to put the random number in the brackets.
country(random number here)
Mar 16 '07 #4
spud379
11
I did it and this is how, if u want to know.

Private choice As Integer
Private random As New Random

choice = random.Next(0, 29)
txtcountry.Text = country(choice)
Mar 28 '07 #5

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

Similar topics

10
by: dave | last post by:
I am reading input from a form. I want to validate the input by making sure that the string is actually an integer. How would I do this? Do i need to convert it to a character array and break down...
6
by: Alex Neumann | last post by:
Hi, I need a function which converts an string to an integer. Currently I have this: bool string2int(char* digit, int& result) { result = 0; if (!(*digit >= '0' && *digit <='9'))
5
by: sathyashrayan | last post by:
Group, I have some doubts in the following program. ------------------program--------------------- /* ** Make an ascii binary string into an integer. */ #include <string.h> unsigned int...
2
by: Sean | last post by:
Hello, I have a function in C# that accepts a stored proc name and an array of parameters, and then returns a dataset, which works just fine. I have converted the function to VB: Public Shared...
8
by: El Camino | last post by:
I need to switch a string to an integer if its strLetter = "A" integer value of 1 if its strLetter = "B" then integer value of 2 if its strLetter = "C" then integer value of 3
6
by: baret bonden | last post by:
I get :Value of type 'String' cannot be converted to '1-dimensional array of String' refering to curitem Dim curItem As String curItem = ListBox1.SelectedItem TextBox1.Text = curItem ...
15
by: Teresa | last post by:
1) Should I use Integer.Parse to convert a string into an integer in .NET now? CType(sUserID, Integer) OR Integer.Parse(sUserID) 2) And is it better to use the string class to trim, get length,...
2
by: yinglcs | last post by:
Can you please tell me why the following code does not work in python? My guess is I need to convert 'count' from a string to an integer. How can I do that? And my understanding is python is a...
1
by: spud379 | last post by:
i am doing an assignment in vb.net. i have to select at random from and array what i have is dim country(29) as string dim random as new random txtcountry.text = random.next(country) I...
9
by: herobeat | last post by:
Hi all, I'm having a hell of a time with declaring a struct to hold some binary data I'm trying to read from some files on disk. What I would like to do is something like this: public struct...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.