?
Solved

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

Posted on 2000-05-01
5
Medium Priority
?
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

718 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