
-----------------------------------
camilito
Mon Mar 21, 2005 4:04 pm

Help on programing a program that formats strings!
-----------------------------------
heres the deal ...
im trying to do a program that takes an input string, increases it to a specified length by catenating the required number of characters (the character is also specified) to either the left or the right of the input string, and catenates the result to whatever is already in the output textbox.

the pic that i put here is just to show what it should look like ater the first click in the "cantenate it" button ... and then when the user inputs new data and and makes a second click of this button..

as u can see this pictures is just to show what im trying to du....but it doesnt work properly..

care to post?

-----------------------------------
Brightguy
Mon Mar 21, 2005 6:38 pm

Re: Help on programing a program that formats strings!
-----------------------------------
Something like this:
Private Sub Command1_Click()
    strOrig = Text1.Text
    intLength = Text2.Text
    strChar = Text3.Text
    
    If Combo1.Text = "right" Then
        Text4.Text = Text4.Text & strOrig & String(intLength - Len(strOrig), strChar)
    ElseIf Combo1.Text = "left" Then
        Text4.Text = Text4.Text & String(intLength - Len(strOrig), strChar) & strOrig
    End If
End Sub

-----------------------------------
camilito
Wed Mar 23, 2005 10:20 am


-----------------------------------
strOrig = Text1.Text 
intLength = Text2.Text 
strChar = Text3.Text 


do these have to be declared ...?.... will there be a problem if the intLenght is not changed to an integer? (I cannot get it to work..)

thanks for the post..

-----------------------------------
camilito
Wed Mar 23, 2005 3:31 pm


-----------------------------------
If the size is less than the length of the input string the string should be truncated ...how du i du that?


The Click event of the Catenate It button should be one statement only, that calls a function. The arguments of the function will be values obtained from properties of the appropriate control objects. There will be four agruments one of them being an integer... 