?
Solved

Color HTML tags

Posted on 1998-08-17
16
Medium Priority
?
163 Views
Last Modified: 2010-04-30
Hello,
I am making a program and I need to know how to color HTML tags in a RichTextBox really quickly.

My current code works like this:
(Do)
1. Use the instr to find "<"
2. Use the instr to find ">"
3. RichTextBox1.Selstart=starttag(the value of the highest)
   RichTextBox1.selstart=endtag(the value of the lower one)
4. RichTextBox1.selcolor=vbblue
(Loop until can't find)

I need a code that will increase the speed by alot.
Thanx!!
0
Comment
Question by:AndrewNg
[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
  • 8
  • 6
  • 2
16 Comments
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1429391
Hi,
1. What is the problem with the speed?
2. Are you using an old pc with low MEM?
3. Is the HTML file is so big?
4. Can you try C or C++ it is faster.
5. Try to do this in VB 5.0:
  A. Go to Project
  B. Go to Project Properties
  C. Click on the Compile TAB and make it Compile to P-Code.

No 5 here will boost your compile time and app run time.

There is a backdraw but not in your case as is.

http://www.hili.com/~shay
shay@hili.com

0
 

Author Comment

by:AndrewNg
ID: 1429392
It's not fast enough!!! I'm using a K-6 233.  I'm trying to color a really large file.  I am using p-code.
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1429393
OKAY, what is the size of the file 100 KB, 500 KB, 1MB?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:a111a111a111
ID: 1429394
Also I don't know why do you need this function but I have a program Ultra Edit 5.0 that
doing the same thing in a flash 1 sec or less.
the Ultra Edit 5.0 is a Hex/Text editor.

You should download/have it .
You will not be sorry if you try the Ultra Edit 5.0


0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1429395
You can see the example of ultra edit 5.20 at http://www.hili.com/~shay/ultraedit.jpg

I am just trying to help you and may be I missed the point and may be not!

Shay
0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1429396
I was checking through the question... as  I worked on a similar thing for my web editor program....... Where do u  get this "ultra Edit"

0
 

Author Comment

by:AndrewNg
ID: 1429397
The file size is 549,663 bytes.  Is the source code availble of this Ultra Edit?
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1429398
Hi, Well not source code, its a commercial program and if you email me your email address I can send it to you.
shay@hili.com.
0
 

Author Comment

by:AndrewNg
ID: 1429399
No, I want the source code.  I already have seen programs that can do this kind of stuff really quickly.
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1429400
OKAY, How long it takes to process the file " 549,663 bytes."

I am about to work on it or you can ZIP your source code and the HTML file and I'll
work on it to boost the speed.

shay@hili.com
0
 

Author Comment

by:AndrewNg
ID: 1429401
Ok, I'm gonna mail it to ya in a second.  Thanx!!!
0
 

Author Comment

by:AndrewNg
ID: 1429402
Do you have ICQ?
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1429403
Yes 8941278.
0
 
LVL 1

Expert Comment

by:MAVERICK
ID: 1429404
a111a111a111, can u check Q10073482
0
 
LVL 3

Accepted Solution

by:
a111a111a111 earned 720 total points
ID: 1429405
Hi, Here is a code with the answer:

Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.1#0"; "RICHTX32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1


Option Explicit ' must have it

Private Sub Command1_Click()
Dim a$
Dim Start As Long
Dim st As Long
Dim ere As Long
Dim f$
Dim StartTime
Dim EndTime
Dim Rc As RichTextBox

Set Rc = Rtb    ' Create valid object reference.
Rc = Rtb
f = FreeFile
CommonDialog1.ShowOpen
Open CommonDialog1.filename For Input As f
Rc.Text = Input(LOF(f), f)
Close f

a = Rc.Text
Start = 1
Rc.SelStart = 0
Rc.SelLength = Len(Rtb)
Rc.SelColor = RGB(0, 0, 0)
Rc.SelLength = 0
Rc.Visible = False ' hide richtextbox
Screen.MousePointer = vbHourglass

StartTime = Timer
Do
  ere = InStr(Start, a, "<")
  If ere Then
    Start = ere
  Else
        Exit Do
  End If
   
  ere = InStr(Start, a, ">")
  If ere Then
    st = ere
    Rc.SelStart = Start - 1
    Rc.SelLength = st - Start + 1
    Rc.SelColor = QBColor(9)
  Else
    Exit Do
  End If
 
  Start = Start + 1
Loop

Close #1
Screen.MousePointer = vbArrow
Rc.Visible = True
EndTime = Timer
MsgBox "Done  " & EndTime - StartTime

End Sub


shay@hili.com
http://www.hili.com/~shay

0
 

Author Comment

by:AndrewNg
ID: 1429406
Adjusted points to 185
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

771 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