Results 1 to 2 of 2

Thread: how can you make this moer erffeicent?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195

    how can you make this moer erffeicent?

    how can you make this moer erffeicent?

    Dim xOrder As String

    Private Sub Command1_Click()
    Dim x As Long
    On Error GoTo mFix
    'MsgBox xOrder
    toMove = Val(Text1.Text) 'Label(1)
    'move 3 over
    For x = 1 To 4
    If Mid$(xOrder, x, 1) = toMove Then
    'MsgBox "Position " & x
    'MsgBox Label1(Mid$(xOrder, x - 1, 1)).Left 'The left of the label to the left of the one to move

    'MsgBox "Order " & xOrder & " Replacing " & Mid$(xOrder, x - 1, 1) & " with " & Mid$(xOrder, x, 1)

    test = Label1(Mid$(xOrder, x, 1)).Left 'The left of the one to move
    test2 = Label1(Mid$(xOrder, x - 1, 1)).Left

    Label1(Mid$(xOrder, x - 1, 1)).Left = test
    Label1(Mid$(xOrder, x, 1)).Left = test2

    xOrder = Replace$(xOrder, Mid$(xOrder, x - 1, 1) & Mid$(xOrder, x, 1), Mid$(xOrder, x, 1) & Mid$(xOrder, x - 1, 1))
    Exit For
    End If
    Next

    Exit Sub
    mFix:
    MsgBox "Cannot move more left"
    End Sub

    Private Sub Form_Load()
    xOrder = "0123"
    End Sub

  2. #2
    New Member
    Join Date
    Apr 2002
    Posts
    4
    What is it that you are trying to do? Change the order of items in a string? Move the position of a control from one location on a page to another?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width