Click here to Skip to main content
15,917,702 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi
friends

my task is

i have one text box when i move mouse on text box it will display like button on right end ,when i click on button drop down list items will displayed after mouse will removed on the text box it will show like text box itself.


please help
Posted

1 solution

Hi,
why don't you use comboBox for this type of situation.
try this one,

take a comboBox control, write the following code under the MouseEnter event and MouseLeave events of comboBox.

C#
private void comboBox1_MouseEnter(object sender, EventArgs e)
        {
            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
        }

        private void comboBox1_MouseLeave(object sender, EventArgs e)
        {
            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
        }

And also write the following code under the Form Load event
C#
private void Form1_Load(object sender, EventArgs e)
        {
            this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
        }

I hope this helps to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900