Re: Anyone want a challenge?
Presumably this is coursework so I won't be writing any code for you and I'm not a big fan of downloading, extracting, opening and then trawling through someone else's project as a first option either. If you can provide some relevant information though, I can provide some direction, but let's handle one issue at a time, shall we? You should ask for help with one issue, resolve it and then start a new thread for the next issue.
With regards to your Buttons, you should just handle the Click event for each one and then, in each event handler, put If...EsleIf statements to determine which RadioButton is checked and then sort accordingly. How you sort depends on a couple of things. Firstly, how is your data stored? Is it in a DataTable, a list/array of objects or something else? Also, are you able to bind your data to the ListBox or do you have to add items manually?
Re: Anyone want a challenge?
I agree. It's a list array. If youll look at my code i have written out the process but it just repeats a word in the wrong column. It needs to rearrange the whole row alphabetically based on the radio button i clicked, departure city or arrival city gets alphabetized.
Re: Anyone want a challenge?
I haven't looked at your code and nor will I as a first option. To my mind, uploading entire should be a last resort. Your first option should be to include the relevant code right in your post, between [code][/code] or [highlight=vb.net][/highlight] tags. That way we can see the code we need to see without going anywhere or doing anything.
Also, there is no such thing as "a list array". There's an array, there's an ArrayList and there's a List(Of T) where T is whatever type you choose to use, but "a list array" doesn't actually mean anything specific.
Re: Anyone want a challenge?
Shows how much i know huh? Like i said it only displays phoenix over and over, and should display the whole row, and not just phoenix.
Heres the code:
If radDepartureCity.Checked Then
gstrNames(0) = "New york"
gstrNames(1) = "Chicago"
gstrNames(2) = "Houston"
gstrNames(3) = "Cincinnati"
gstrNames(4) = "Albany"
gstrNames(5) = "Phoenix"
Dim intpassNum As Integer, i As Integer, strTemp As String
For intpassNum = 0 To 4
For i = 0 To 4 - intpassNum
If gstrNames(i) > gstrNames(i + 1) Then
strTemp = gstrNames(i)
gstrNames(i) = gstrNames(i + 1)
gstrNames(i + 1) = strTemp
End If
Next i
Next intpassNum
End If
End Sub
Re: Anyone want a challenge?
It looks like you have multiple arrays. The code you have is just going to sort the departure city names without keeping the related data for each flight in the same order. Is that going to be OK? It seems that you are not maintaining the relationships among the three separate data items for each flight at all.
Re: Anyone want a challenge?
Right. I need to keep the whole line of text their: flight number, departure city, time, arrival city, time, fare, etc. and it just keeps displaying phoenix i have no idea what im doing.
Re: Anyone want a challenge?
If you need to keep all the data for a flight together then just sorting the names is no good to you. Even if it sorts correctly, the names will be in the correct order but nothing else will be and you'll have lost the relationship between each name and the rest of the data that it is associated with. Can you see that? Have you been told to use separate arrays for each field?