Hey, am having 3 radiobuttons, so if any of them is checked, then the price should be display on a label, but it has to be using array. I have started, but i got hooked at this point.

Dim AccStandard() As String = {"5 Star", "4 Star", "Budget"}
    Dim cost() As Integer = {200, 100, 60}
    Dim index As Integer
    For index = 0 To AccStandard.Length - 1
        If Accomodation = AccStandard(index) Then
            ResultLabe.text =  cost(index)
        End If
    Next

Where do you have this code? In an event handler? What is Accomodation in the line If Accomodation = AccStandard(index) Then ?

but i got hooked at this point.

At what point you're hooked?

Give enough details and code, please.

The code is in the event handler,

Dim AccStandard() As String = {"5 Star", "4 Star", "Budget"}
Dim cost() As Integer = {200, 100, 60}
Dim accomodation as string = Textbox.text
Dim index As Integer
For index = 0 To AccStandard.Length - 1
If Accomodation = AccStandard(index) Then
ResultLabe.text = cost(index)
End If
Next

Ok. Actually there's nothing wrong with your code. I tested it and it run just fine.

But. I don't see how your code is related with radiobuttons

am having 3 radiobuttons, so if any of them is checked

You take the user input with Dim accomodation as string = Textbox.text , is this correct? If it is, then all "valid" inputs are "5 Star", "4 Star", "Budget" (w/o quotes) and you may want to change the test If Accomodation = AccStandard(index) Then to If Accomodation.ToUpper = AccStandard(index).ToUpper Then in order to ignore case.

The code is in the event handler

Could you please show the whole event handler?

Maybe you should also clarify your question. I have a feeling that I'm not answering your question :-/

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.