I want to create a class in which I typed the text between "" then the text color get changed.
and also yes, I want to change the text color for some words.
Yes it is somewhat similar like the Script Editor.
Can anyone help me with this?

Recommended Answers

All 4 Replies

Hi
You will need to based your new class on a richtextbox to allow different formating within the text. You will also need to overwrite the ToString to parse the input and format the text accordingly

G_Waddell
sorry, but Can you explain me in detail ?

OK you'll need to do something like this:

Public Class MyFomattedTextbox
    Inherits System.Windows.Form.RichTextbox

    Public Overrides Function ToString()
        'parse the text inside the richtextbox
        'if you find " " then format the text between each one      
       dim i, x as integers
       i =instr(me.Text, chr(34))
       while i <> 0
           'got first " - find the next
           y = (i, me.text, chr(34))
           if y = 0 then
               exit while
           else
               'format the string between i and y
               i = y + 1
           end if
           if i > len(me.text) then
               exit while
           end if
       end while
    End Function

End Class

oops, i can't understand whether y is string or integer.
and I thing I make some mistake in your coding.
can you explain with the example.
here is an example coding that I try.
and the first some comment line describe about the problem or that I want to do.
attachment:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.