Re: Comparing and Ranking Textboxes

Tech-Archive recommends: Fix windows errors by optimizing your registry



I'm not 100% sure I understand what it is you're looking for, but the code
below shows adding the values to an array and then using that array to
repopulate the textboxes with the values sorted. Note that .LostFocus event
is handled instead of TextChanged --- other wise some unexpected results
occur.

Private Sub TextBoxValueChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) _

Handles TextBox1.LostFocus, TextBox2.LostFocus, TextBox3.LostFocus,
TextBox4.LostFocus, TextBox5.LostFocus

' load value into an array

Dim arr(4) As String

arr(0) = TextBox1.Text

arr(1) = TextBox2.Text

arr(2) = TextBox3.Text

arr(3) = TextBox4.Text

arr(4) = TextBox5.Text

' sort the array

Array.Sort(arr)

' output sorted values to text boxes

TextBox1.Text = arr(0).ToString

TextBox2.Text = arr(1).ToString

TextBox3.Text = arr(2).ToString

TextBox4.Text = arr(3).ToString

TextBox5.Text = arr(4).ToString

End Sub


.



Relevant Pages

  • sort 1-D array of doubles for Olaf Schmidt
    ... A few weeks Olaf Schmidt posted a VB6 routine to sort a 1-D array of strings very fast indeed. ... fastest way to change case of string. ... Dim i As Long, j As Long, Lo As Long, Hi As Long, StPtr As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: Collection Structure
    ... property StringID you want ... where inarr is the String array and outarr is an array of longs containing ... needs to sort the input array keeping track of the original position (I use ...
    (microsoft.public.vb.com)
  • Re: string array / collection ? what should I use ?
    ... Use array of user-defined types. ... sPerson as String ... Private Sub PrintScript ... > First Witch, Boil thou first i' the charmed pot. ...
    (microsoft.public.vb.general.discussion)
  • Re: About word frequency
    ... Use the split function to turn the string into an array. ... Sort the array. ... For each sLine in aList ...
    (microsoft.public.scripting.vbscript)
  • Re: Help with multidimensional arrays!
    ... Private Sub load_risk_array(raised_date As String, description As String, ... ReDim Preserve risk_array ... I have an array as mentioned above. ...
    (microsoft.public.vb.general.discussion)