I have this structure:
Module Global_Variables
Public myrecords(10) As myDatabase
Public counter As Integer = 0
Public Structure myDatabase
'creates database Structure For input data
<VBFixedString(30)> _
Dim Driver As String '30 bytes
Dim Car As Integer '4 bytes
<VBFixedString(15)> _
Dim Team As String '15 bytes
Dim Grid As Integer '4 bytes
Dim FastestLap As Double '8 bytes
Dim RaceTime As Double '4 bytes
Dim Points As Double '4 bytes
End Structure
End Module
The program receives data from the user and then displays the data in a text box called txtOutput in another form:
myrecords(counter).Driver = driver_box.Text
myrecords(counter).Car = car_box.Text
myrecords(counter).Team = team_box.Text
myrecords(counter).Grid = grid_box.Text
myrecords(counter).FastestLap = fl_box.Text
myrecords(counter).RaceTime = rt_box.Text
myrecords(counter).Points = points_box.Text
Form_Display.txtDisplay.AppendText(myrecords(counter).Driver & " " &
myrecords(counter).Car & " " & myrecords(counter).Team & " " &
myrecords(counter).Grid & " " & myrecords(counter).FastestLap & " " &
myrecords(counter).RaceTime & " " & myrecords(counter).Points & vbCrLf)
counter = counter + 1
MsgBox("Submit success!")
Call input_box_clear()
The user can then click a button to sort the records in ascending order by fastest lap. How do I do this?
I have tried algorithms such as bubble sort and selection sort but neither worked.
Thank you
Structuretypes larger than 16 bytes. Anything >16 - declare a class.String.Format()as a better option for building your display string.VBFixedStringindicates he may be relying on an API that requires a structure.