Solved

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

Posted on 2000-05-01
5
154 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now