I am trying to write a code that displays the contents of an array called rates in the ratesLabel using a For...Next statement. I think I have some of the work done.
This is what I have:
I have the click options for my display and exit buttons,
the numbers options for my numbers and products text boxes, and
I have some declaration statements.
Here are my declaration statements

Dim numbers(20) As Integer
Dim products(10) As String
Dim rates() As Decimal = {6.5, 8.3, 4.2, 10.5}
Dim subscript As Integer

numbers(1) = 7
products(2) = "Paper"

For subscript As Integer = 0 To 4
ratesLabel.Text = rates.ToString
Next subscript

Now I don't really know if this is correct or if I am completely off.
Any help will be greatly appreciated.
Thank you.

Recommended Answers

All 4 Replies

Hi,

You mean you want to show the contents of the array one by one with a time phase between them??

Hi,

You mean you want to show the contents of the array one by one with a time phase between them??

I think that the rates are supposed to correspond to the number and product that the user is supposed to enter.

Your:
ratesLabel.Text = rates.ToString
should be some thing like this:
ratesLabel.Text = rates(Index).ToString

Index is set to the rate you want.

i did not understand why u use For loop ,
do you want to show all the array's content in one label ? if yes then

For subscript As Integer = 0 To [B]3[/B]
ratesLabel.Text =[B]ratesLabel.Text[/B]+ " "+ rates(index).ToString
Next subscript

if you want to show only one rate then you do not need for loop , just search in rate array for value correspond to what user entered and then show it in label
hope this help you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.