Results 1 to 13 of 13

Thread: Any way to make these shorter?

Hybrid View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    19

    Re: Any way to make these shorter?

    Thanks Spoo! i made my array copying and pasting C1 (commandbuttons)
    I renamed the Captions CH01, CH02 etc..

    Code:
    Private Sub C1_Click(index As Integer)
        Label1.Caption = C1(index).Caption
        
    End Sub
    Now when i click on the buttons, the CH01 and CH02 show up as my Label1.Caption. Is there any way to remove the CH part of it?

    Thanks for everyones patience, i am re-creating my app slowly.

  2. #2
    Hyperactive Member Lenggries's Avatar
    Join Date
    Sep 2009
    Posts
    353

    Re: Any way to make these shorter?

    Quote Originally Posted by bthology View Post
    Now when i click on the buttons, the CH01 and CH02 show up as my Label1.Caption. Is there any way to remove the CH part of it?
    Code:
    Private Sub C1_Click(index As Integer)
        Label1.Caption = index
    End Sub
    You may have on off-by-one error, in which case you would use index + 1 instead.

    Alternatively, if you want to separate your computer numbers from the computer labels (ie. Computer #107 occupies the 93rd slot, for example), you would use this:



    Code:
    Private Sub C1_Click(index As Integer)
        Label1.Caption = Right$(C1(index).Caption,Len(C1(index).Caption-2)
    End Sub

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