I'm writing a routine where the user can populate up to 8 textboxes with numbers. Since there is potential for these numbers to be unsorted, I want to sort these prior to saving. However it's probable that all of the textboxes will not be used. My challenge then is how to ignore the blank textboxes and not include them in the sort.
In my test, I've used 4 of the 8 boxes. It sorts perfectly - except it puts the blank textboxes first.
I've tried various versions of the following with no success. Are there any thoughts as to how to fix this?
Dim IntArr(7) As String
If tbxProp1.Text <> "" Then
IntArr(0) = tbxProp1.Text
End If
If tbxProp2.Text <> "" Then
IntArr(1) = tbxProp2.Text
End If
If tbxProp3.Text <> "" Then
IntArr(2) = tbxProp3.Text
End If
If tbxProp4.Text <> "" Then
IntArr(3) = tbxProp4.Text
End If
If tbxProp5.Text <> "" Then
IntArr(4) = tbxProp5.Text
End If
If tbxProp6.Text <> "" Then
IntArr(5) = tbxProp6.Text
End If
If tbxProp7.Text <> "" Then
IntArr(6) = tbxProp7.Text
End If
If tbxProp8.Text <> "" Then
IntArr(7) = tbxProp8.Text
End If
Array.Sort(IntArr)
tbxProp1.Text = IntArr(0)
tbxProp2.Text = IntArr(1)
tbxProp3.Text = IntArr(2)
tbxProp4.Text = IntArr(3)
tbxProp5.Text = IntArr(4)
tbxProp6.Text = IntArr(5)
tbxProp7.Text = IntArr(6)
tbxProp8.Text = IntArr(7)
In advance, thanks for your assistance.
Don