Results 1 to 6 of 6

Thread: Simple I Think

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Simple I Think

    Code:
    Private Sub Command3_Click()
    
    Dim X As Integer, Y As Integer, Z As Integer
    Dim Word As String
    
    For X = 0 To List1.ListCount - 1
    Y = 0
    Z = 0
    
    Do While Y <= 30
        Do While Z <= 30
            Word = String(Y, "x") & List1.List(X) & String(Z, "x")
            If Len(Word) <= 32 Then
                List2.AddItem Word
            End If
        Z = Z + 1
        Loop
        Z = 0
        Y = Y + 1
        Loop
        
        Next X
    String(Y, "x") works fine but i try and do String(Y, "xo") it stil only uses the X, how do i do it so i can have a number of characters ??
    Im Learning !!!!

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Simple I Think

    What is it that you are trying to do?

    What is in your listbox?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Re: Simple I Think

    With the code above, it makes Ricky into

    XRicky
    XXRicky
    XXRickyXXXXXx

    etc etc

    but trying to get it to do

    OXRicky
    OXOXRicky
    OXRickyOXOX

    etc etc
    Im Learning !!!!

  4. #4
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: Simple I Think

    The String() function will only accept 1 character, if you specify more than one then it uses the first one.


    casey.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2005
    Posts
    300

    Re: Simple I Think

    so what the relative function to String() that i can use for two characters?
    Im Learning !!!!

  6. #6
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Simple I Think

    I'm afraid there isn't so may need to write your own (perhaps something like the one below):
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4. Dim sFill$
    5.  
    6.     sFill = "AB"
    7.     Debug.Print ConcatString(sFill, 5)
    8.  
    9. End Sub
    10.  
    11. Public Function ConcatString(sChars As String, iNum As Integer) As String
    12. Dim i%, sOutput$
    13.  
    14.     For i = 1 To iNum
    15.         sOutput = sOutput & sChars
    16.     Next i
    17.     ConcatString = sOutput
    18.  
    19. End Function

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