Sorting multiple array textboxes

bmruze

Member
Joined
Jan 20, 2008
Messages
6
Location
Michigan, USA
Programming Experience
1-3
In my last post here http://vbdotnetforums.com/showthread.php?p=74001&highlight=bmruze#post74001
I asked a question about stopping tabbing into a textbox. Thanks for your help guys.

My other problem is now also related to this same project. I have created all of those boxes and now in this picture below you can see that I have entered in some numbers and it puts the smallest number into the last row of textboxes.... my problem is now that I need to figure out how to sort these textboxes so that if the time in car number 3 is smaller than the time in car number 1 then they will swap places.

carlistwithnumbers.jpg


any ideas on how to sort textbox arrays?
 
You should sort your data array before displaying in UI, not sort the UI controls.
 
You should sort your data array before displaying in UI, not sort the UI controls.

That's kind of a problem. The user enters data into the first 3 textboxes named:
Car #
1st Lap
2nd Lap

The "Fastest Time" textboxes simply take the numbers from 1st lap and 2nd Lap, finds the smaller number and places them into the "Fastest Time" textboxes.

The user enters in the information into all those textboxes, so sorting the boxes before the UI shows is rather impossible.
 
In that case user should sort the data before inputting it. Else provide the user a better user-interface, a DataGridView is sortable for instance. Else gather the data from your textboxes, sort the data, then fill in the sorted data.
 
I agree with using a data grid view and am in the process of testing this in both views. I know that this kinda goes into a different topic if that is the direction that I'm going to head. I'll ask a question to see if I can be helped out here before going in that direction.

When using a datagrid I can't seem to find a way to edit what a user types into the boxes(ie datagrid1.text) or something to that effect. Any thoughts?
 
Start by reading some in documentation for DataGridView and possibly related online tutorials that you may find interesting.
A cell may be accessed for example from the Item property, providing row and column index, this is default property so it can be shorted:
VB.NET:
DataGridView1(0, 0).Value = "0,0"
 
Back
Top