Link to home
Start Free TrialLog in
Avatar of jasinski
jasinski

asked on

How do I put Text in a box around other text?

My question is this, I have a to Text boxes. One which you put data into and the second displays the result.

Now when I press a button my program will convert normall ASCII code to Hex but the Hex must stay on ONE line and must have around it other PRE SET info which would be displayed once I press the button.

So it would like this.

LINE 1
LINE 2
LINE 3 'HEX CODE ALSO GOES ON LINE 3 BETWEEN '...' LIKE I HAVE IT HERE'
LINE 4



How do I do this?

My code:

Dim lp As Integer
Dim length As Integer
Dim newstring As String
Dim holder As String
length = Len(Text1.Text)
If length > 0 Then
newstring = ""
  For lp = 1 To length
    holder = "%" & Hex(Asc(Mid$(Text1.Text, lp, 1)))
    newstring = newstring & holder
    Text2.Text = newstring
  Next lp
Else
  Text2.Text = ""
End If

Avatar of AzraSound
AzraSound
Flag of United States of America image

ok so what problem are you having?
you can put it all on the outside of your for loop:


For lp = 1 To length
    holder = "%" & Hex(Asc(Mid$(Text1.Text, lp, 1)))
    newstring = newstring & holder
Next lp

Text2.Text = "HEX CODE ALSO GOES ON LINE 3 BETWEEN " & newstring & " LIKE I HAVE IT HERE"


Avatar of jasinski
jasinski

ASKER

Thats all most I need !!!

Okay I need it to display the following lines but NEWSTRING must remain on the one line !!!


Thanks you so much it's almost working!!!!!

<Script Language='Javascript'>
<!--
eval(unescape('NEWSTRING GOES HERE'));
//-->
</Script>
ASKER CERTIFIED SOLUTION
Avatar of AzraSound
AzraSound
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the great answer. You have been a huge help !