Skip to main content
added markdown to code terms in text body, fixed minor typos
Source Link
Pikalek
  • 13.4k
  • 5
  • 49
  • 54

I am developing a character creator using Windows Forms (because apparently I can't create menus in Unity), and I want to display some tips and descriptions in a RichTextBoxRichTextBox located by the options when the user's mouse hover by it's GroupBoxesits GroupBoxes.

Since iI am fairly new to programming I don't know if getting all the controlscontrols' names one by one is the optimal, so I want to grab the controls' names inside of the tabControltabControl control that I am using to organize everything.

private void TabControl1_MouseHover(object sender, EventArgs e)
        {
            foreach(Control c in this.Controls)
            {
                string name = c.Name;
                TooltipText(name);
            }
        }

And I also have a method where I will write the text that will be displayed in the RichTextBoxRichTextBox

private string TooltipText(string name)
        {
            if(name == "Name:")
            {
                return "blabla";
            }
            else
            {
                return "none";
            }
        }

I've tried a generic method to show a message box if the control was detected and, as I suspected, nothing showed up:

private void TooltipText(string name)
        {
            if(name == "LBL_Name")
            {
                MessageBox.Show("hey");
                return;
            }
        }

How can iI properly detect the GroupboxesGroupBoxes or other types of Controlscontrols inside of the TabControlTabControl control and also display the text in the box beside it?

I am developing a character creator using Windows Forms (because apparently I can't create menus in Unity), and I want to display some tips and descriptions in a RichTextBox located by the options when the user's mouse hover by it's GroupBoxes.

Since i am fairly new to programming I don't know if getting all the controls names one by one is the optimal, so I want to grab the controls' names inside of the tabControl control that I am using to organize everything.

private void TabControl1_MouseHover(object sender, EventArgs e)
        {
            foreach(Control c in this.Controls)
            {
                string name = c.Name;
                TooltipText(name);
            }
        }

And I also have a method where I will write the text that will be displayed in the RichTextBox

private string TooltipText(string name)
        {
            if(name == "Name:")
            {
                return "blabla";
            }
            else
            {
                return "none";
            }
        }

I've tried a generic method to show a message box if the control was detected and, as I suspected, nothing showed up:

private void TooltipText(string name)
        {
            if(name == "LBL_Name")
            {
                MessageBox.Show("hey");
                return;
            }
        }

How can i properly detect the Groupboxes or other types of Controls inside of the TabControl control and also display the text in the box beside it?

I am developing a character creator using Windows Forms (because apparently I can't create menus in Unity), and I want to display some tips and descriptions in a RichTextBox located by the options when the user's mouse hover by its GroupBoxes.

Since I am fairly new to programming I don't know if getting all the controls' names one by one is the optimal, so I want to grab the controls' names inside of the tabControl control that I am using to organize everything.

private void TabControl1_MouseHover(object sender, EventArgs e)
        {
            foreach(Control c in this.Controls)
            {
                string name = c.Name;
                TooltipText(name);
            }
        }

And I also have a method where I will write the text that will be displayed in the RichTextBox

private string TooltipText(string name)
        {
            if(name == "Name:")
            {
                return "blabla";
            }
            else
            {
                return "none";
            }
        }

I've tried a generic method to show a message box if the control was detected and, as I suspected, nothing showed up:

private void TooltipText(string name)
        {
            if(name == "LBL_Name")
            {
                MessageBox.Show("hey");
                return;
            }
        }

How can I properly detect the GroupBoxes or other types of controls inside of the TabControl control and also display the text in the box beside it?

Source Link

Getting a control name/Displaying tooltip text

I am developing a character creator using Windows Forms (because apparently I can't create menus in Unity), and I want to display some tips and descriptions in a RichTextBox located by the options when the user's mouse hover by it's GroupBoxes.

Since i am fairly new to programming I don't know if getting all the controls names one by one is the optimal, so I want to grab the controls' names inside of the tabControl control that I am using to organize everything.

private void TabControl1_MouseHover(object sender, EventArgs e)
        {
            foreach(Control c in this.Controls)
            {
                string name = c.Name;
                TooltipText(name);
            }
        }

And I also have a method where I will write the text that will be displayed in the RichTextBox

private string TooltipText(string name)
        {
            if(name == "Name:")
            {
                return "blabla";
            }
            else
            {
                return "none";
            }
        }

I've tried a generic method to show a message box if the control was detected and, as I suspected, nothing showed up:

private void TooltipText(string name)
        {
            if(name == "LBL_Name")
            {
                MessageBox.Show("hey");
                return;
            }
        }

How can i properly detect the Groupboxes or other types of Controls inside of the TabControl control and also display the text in the box beside it?