HelpVb Code READER !

Posts 1–15 of 22 · Page 1 of 2
Vb Code READER !
I Need to Make a Vb COde Reader Like
I Type in text box And if I Opened Quotes " it Changes to Brown "
and when i type Dim it gets blue
'and so on !

How Can I Make This In a Textbox or richtextbox ?
Syntax Highlighter is what you're after

There are many tutorials on how to make "nooby" ones.
>C++ is more the way to go for making such 'custom' controls for such support.

But there is some options you can look at.

The 'easy' and simple but also a nooby way. (IMO)
-But I can't think of anything else now so...

Would be the mark the text, color it. Then continue the progress for each find of the word.
>Would be very slow and take much resources.

(I'll look around to see if I can find something to help you )
Quote Originally Posted by Jorndel View Post
Syntax Highlighter is what you're after

There are many tutorials on how to make "nooby" ones.
>C++ is more the way to go for making such 'custom' controls for such support.

But there is some options you can look at.

The 'easy' and simple but also a nooby way. (IMO)
-But I can't think of anything else now so...

Would be the mark the text, color it. Then continue the progress for each find of the word.
>Would be very slow and take much resources.

(I'll look around to see if I can find something to help you )
SERIOUSLY !! ThanQ So Much !!
i need Something with visual basic If u can !!
Quote Originally Posted by steveroseik View Post
SERIOUSLY !! ThanQ So Much !!
i need Something with visual basic If u can !!
Google is your friend:

It's in C# but C# & VB is mainly the same language. (Just a very different syntax and some more stuff)
But you will get the idea of it so...
Fast Colored TextBox for Syntax Highlighting - CodeProject
Quote Originally Posted by Jorndel View Post


Google is your friend:

It's in C# but C# & VB is mainly the same language. (Just a very different syntax and some more stuff)
But you will get the idea of it so...
Fast Colored TextBox for Syntax Highlighting - CodeProject
Can You COnvert it to VB or Tell Me The IDEA Cause I Don't know anything about C#
How retarded is this guy?
Quote Originally Posted by LilGho$t View Post
How retarded is this guy?
What do u Mean ?!

---------- Post added at 06:39 PM ---------- Previous post was at 06:38 PM ----------

The Whole idea is to make a Vb.net Code Viewer or reader or editor !!
Quote Originally Posted by steveroseik View Post
What do u Mean ?!

---------- Post added at 06:39 PM ---------- Previous post was at 06:38 PM ----------

The Whole idea is to make a Vb.net Code Viewer or reader or editor !!

Code Converter | Provided by Telerikⓘ
Quote Originally Posted by steveroseik View Post
What Should I Do With ThiS ?!
Use ur brain... Convert the c# code the guy posted above to vb.net

PLEASE USE THE NOGGIN OF WISDOM
Quote Originally Posted by Vibrations View Post
Use ur brain... Convert the c# code the guy posted above to vb.net

PLEASE USE THE NOGGIN OF WISDOM
I Had Tried This !! it Just Created a Class The Makes a New SyntaxRichTextBox That Change The Color Of The Numbers and Quotes ONLY !!

I Have This Code :
Code:
      Dim words As List(Of String) = New List(Of String)(New String() {"AddHandler", _
"AddressOf", _
"Alias", _
"And", _
"AndAlso", _
      "Ansi", _
"As", _
        "Assembly", _
       " Auto", _
"Boolean", _
"ByRef", _
"Byte", _
"ByVal", _
"Call", _
"Case", _
"Catch", _
"CBool", _
"CByte", _
"CChar", _
"CDate", _
"CDec", _
"CDbl", _
"Char", _
"CInt", _
"Class", _
"CLng", _
"CObj", _
"Const", _
"CShort", _
"CSng", _
"CStr", _
"CType", _
"Date", _
"Decimal", _
"Declare", _
"Default", _
"Delegate", _
"Dim", _
"DirectCast", _
"Do", _
"Double", _
"Each", _
"Else", _
"ElseIf", _
"End", _
"Enum", _
"Erase", _
"Error", _
"Event", _
"Exit", _
"False", _
"Finally", _
"For", _
"Friend", _
"Function", _
"Get", _
"GetType", _
"GoSub", _
"GoTo", _
"Handles", _
"If", _
"Implements", _
"Imports", _
"In", _
"Inherits", _
"Integer", _
"Interface", _
"Is", _
"Let", _
"Lib", _
"Like", _
"Long", _
"Loop", _
"Me", _
"Mod", _
"Module", _
"MustInherit", _
"MustOverride", _
"MyBase", _
"MyClass", _
"Namespace", _
"New", _
"Next", _
"Not", _
"Nothing", _
"NotInheritable", _
"NotOverridable", _
"Object", _
"On", _
"Option", _
"Optional", _
"Or", _
"OrElse", _
"Overloads", _
"Overridable", _
"Overrides", _
"ParamArray", _
"Preserve", _
"Private", _
"Property", _
"Protected", _
"Public", _
"RaiseEvent", _
"ReadOnly", _
"ReDim", _
 "REM", _
"RemoveHandler", _
"Resume", _
"Return", _
"Select", _
"Set", _
"Shadows", _
"Shared", _
"Short", _
"Single", _
"Static", _
"Step", _
"Stop", _
"String", _
"Structure", _
"Sub", _
"SyncLock", _
"Then", _
 "Throw", _
"To", _
"True", _
 "Try", _
"TypeOf", _
  "Unicode", _
  "Until", _
"Variant", _
"When", _
"While", _
"With", _
"WithEvents", _
"WriteOnly", _
"Xor", _
"#Const", _
"#ExternalSource", _
"#If...Then...#Else", _
"#Region"})
Tell Me How to :
Code:
If The Richtextbox contains any of the list above then
change color to blue
ANYONE COULD HELP ?!!
Can you code in vb? If so, how long.
Have a go at it and see what you come up with.
Just check the string to see if it contains any of the keywords,
get it's location/length in the string and change the color.
Quote Originally Posted by Pingo View Post
Can you code in vb? If so, how long.
Have a go at it and see what you come up with.
Just check the string to see if it contains any of the keywords,
get it's location/length in the string and change the color.
Give Me The Code !!
Quote Originally Posted by steveroseik View Post
Give Me The Code !!
We're not here to spoon feed you.
We're here to help you, not to give you something that you can Copy & Paste.

>Then we could just have made it ourselves...
Quote Originally Posted by Jorndel View Post


We're not here to spoon feed you.
We're here to help you, not to give you something that you can Copy & Paste.

>Then we could just have made it ourselves...
That was So Helpful -.-

---------- Post added at 08:54 PM ---------- Previous post was at 07:45 PM ----------

I Made It !!
Code:
If RichTextBox1.Text.Length > 0 Then
            Dim selectStart As Integer = RichTextBox1.SelectionStart
            RichTextBox1.Select(0, RichTextBox1.Text.Length)
            RichTextBox1.SelectionColor = Color.Black
            RichTextBox1.DeselectAll()
            For Each oneWord As String In words
                Dim pos As Integer = 0
                Do While RichTextBox1.Text.ToUpper.IndexOf(oneWord.ToUpper, pos) >= 0
                    pos = RichTextBox1.Find(oneWord.ToUpper, RichTextBoxFinds.WholeWord)
                    RichTextBox1.Select(pos, oneWord.Length)
                    RichTextBox1.SelectionColor = Color.Blue
                    pos += 1
                Loop
            Next
            RichTextBox1.SelectionStart = selectStart
            RichTextBox1.SelectionLength = 0
        End If
But I'm Facing a New Problem Right Now !
When I Start Typing Manually it Works Fine !!
But When I Paste a Whole Code This Error Pops Up !

And I Got This Other Code :
Code:
   Dim rx As New Regex("AddHandler |AddressOf |Alias |And |AndAlso |Ansi |As |Assembly |Auto |Boolean |ByRef |Byte |" + _
"ByVal |Call |Case |Catch |CBool |CByte |CChar |CDate |CDec |CDbl |Char |CInt |Class |CLng |CObj |Const |CShort |CSng |" + _
"CStr |CType |Date |Decimal |Declare |Default |Delegate |Dim |DirectCast |Do |Double |Each |Else |ElseIf |End |Enum |" + _
"Erase |Error |Event |Exit |False |Finally |For |Friend |Function |Get |GetType |GoSub |GoTo |Handles |If |Implements |Imports |" + _
"In |Inherits |Integer |Interface |Is |Let |Lib |Like |Long |Loop |Me |Mod |Module |MustInherit |MustOverride |MyBase |" + _
"MyClass |Namespace |New |Next |Not |Nothing |NotInheritable |NotOverridable |Object |On |Option |Optional |Or |OrElse |" + _
"Overloads |Overridable |Overrides |ParamArray |Preserve |Private |Property |Protected |Public |RaiseEvent |ReadOnly |ReDim |" + _
"REM |RemoveHandler |Resume |Return |Select |Set |Shadows |Shared |Short |Single |Static |Step |Stop |String |Structure |Sub |" + _
"SyncLock |Then |Throw |To |True |Try |TypeOf |Unicode |Until |Variant |When |While |With |WithEvents |WriteOnly |Xor |#Const |#ExternalSource |#If...Then...#Else |#Region |")
        For Each m As Match In rx.Matches(RichTextBox1.Text)
            RichTextBox1.SelectionStart = m.Index
            RichTextBox1.SelectionLength = m.Value.Length
            RichTextBox1.SelectionColor = Color.Blue
        Next
        rx = New Regex(""".+""")
        For Each m As Match In rx.Matches(RichTextBox1.Text)
            RichTextBox1.SelectionStart = m.Index
            RichTextBox1.SelectionLength = m.Value.Length
            RichTextBox1.SelectionColor = Color.Tomato
        Next
It Works So Fine With Pasting The Whole COde !
How to Make an "IF" Code which gives this Meaning :
Code:
If paste function occured then
generate the second code
esle
generate the first code
AND I'M ON THE RichTextBox.textChanged Sub
Posts 1–15 of 22 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us