Solved

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

Posted on 2000-05-01
5
156 Views
Last Modified: 2010-05-02
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

0
Comment
Question by:jasinski
  • 3
  • 2
5 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2768249
ok so what problem are you having?
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2768261
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"


0
 

Author Comment

by:jasinski
ID: 2768359
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>
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 10 total points
ID: 2768386
ok i dont know javascript but if you are merely trying to print this to a textbox (assuming you have it set as multiline) then try this:

Text2.Text = "<Script Language='Javascript'>" & vbCrLf & "<!--" & vbCrLf & "eval(unescape(" & newstring & "));" & vbCrLf & "//-->" & vbCrLf & "</Script>"
0
 

Author Comment

by:jasinski
ID: 2768710
Thanks for the great answer. You have been a huge help !
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question