Sep 23rd, 2002, 07:54 AM
#1
Thread Starter
New Member
HTML Color coding
Ive been wanting to make a program that basically is a html editor. But i also want to make it with color coding.
Any idea's?
I had the idea of the Find method in the rich text box and search for "<" and ">" and the = and " in a HTML tag and change the SelectedColor and change the properties in a html tag. Like id and so on...
The problem is with this is that when i type straight after the ">" or any other colored thingy the text will be that color
and it looses focos of where i am typing it will loose focus.
Does anyone know the code that they use in frontpage, ultradev, dreamweaver and visual studio that changes color of the text or any other good code.
Plz help me. I am sorta newb
Sep 23rd, 2002, 08:16 AM
#2
Lively Member
This was something i was playing with never took it anywhere. If you want more help just ask.
You need to add reference to Microsoft VBScript Regular Expressions
VB Code:
Private Sub Command1_Click()
Dim regEx As New RegExp
'regEx.Pattern = "(\<.*?\>).*?(\<\/.*?\>)"
regEx.Pattern = "\<.*?\>"
'regEx.Pattern = "<[^<>]+>"
regEx.Global = True
Set matches = regEx.Execute(rtbCode.Text)
Dim match As match
For Each match In matches
rtbCode.SelStart = match.FirstIndex
rtbCode.SelLength = match.Length
rtbCode.SelColor = colorMe(match.Value)
rtbCode.SelBold = True
Next
colorSpeech
End Sub
Function colorSpeech()
Dim regEx As New RegExp
'regEx.Pattern = "(\<.*?\>).*?(\<\/.*?\>)"
regEx.Pattern = "\'.*?\'"
'regEx.Pattern = "<[^<>]+>"
regEx.Global = True
Set matches = regEx.Execute(rtbCode.Text)
Dim match As match
For Each match In matches
rtbCode.SelStart = match.FirstIndex
rtbCode.SelLength = match.Length
rtbCode.SelColor = &H8000& 'colorMe(match.Value)
rtbCode.SelBold = False
Next
End Function
Sep 23rd, 2002, 08:40 AM
#3
Thread Starter
New Member
I looked through the references and couldn't find a reference exactly the same as Microsoft VBScript Regular Expressions.
But i did find Microsoft VBScript Regular Expressions 1.0
and Microsoft VBScript Regular Expressions 5.5
I added both and there is no type RegExp match and matches defined.
Sorry i cant fix it myself but can u plz help me...again.
Sep 23rd, 2002, 09:12 AM
#4
Thread Starter
New Member
I looked through the references and couldn't find a reference exactly the same as Microsoft VBScript Regular Expressions.
But i did find Microsoft VBScript Regular Expressions 1.0
and Microsoft VBScript Regular Expressions 5.5
I added both and there is no type RegExp match and matches defined.
Sorry i cant fix it myself but can u plz help me...again.
Sep 23rd, 2002, 09:34 AM
#5
Lively Member
You should only need one 5.5 I suggest a this should work unless they have changed the type for regexp in .net im only VB 6.
You could try deleting the regexp bit and let vb fill it in for you.
Sep 24th, 2002, 04:40 AM
#6
Lively Member
Dont know if you can open VB6 projects in .Net but here is some code.
Hope its useful
Attached Files
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width