Elegiac
Elegiac

Reputation: 366

ToolTip in SpecificText inside RichTextBox using MouseOver

im working on a code-editor and im just wondering how to make tooltip in text since its usually on tools in c# with a mouseover functionality . something like this:

enter image description here

sample senario,

when i type "abc" in richtextbox and mouseover it ToolTip with a Message "this is an alphabet" will appear . same as with "123" inputted in richtextbox and get mouseover "this is a number will appear" .

is there anyway i can do that? without flooding or using any keypress? just mouseover in text? thanks a lot really need a help .

Upvotes: 0

Views: 962

Answers (1)

Sathish
Sathish

Reputation: 4487

Try This Code:

 private void richTextBox1_MouseHover(object sender, EventArgs e)
        {
            double x;


            if (double.TryParse(richTextBox1.Text, out x))
            {
                toolTip1.Show(this is a number will appear",richTextBox1);

            }
            else
            {
                toolTip1.Show("this is an alphabet",richTextBox1);
            }

        }

Upvotes: 1

Related Questions