Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2000-05-01
5
Medium Priority
?
162 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 40 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

971 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