I think you are using ASP.NET. where as i dont have any option to dropdownlist in my toolbox. I am working on C#.NET where i use Combobox which i have added the content manually. Here is my code with a simple combobox.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Combobox_tooltip
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private ToolTip toolTip1;
private System.Windows.Forms.ComboBox comboBox1;
private System.ComponentModel.IContainer components;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.SuspendLayout();
//
// comboBox1
//
this.comboBox1.Items.AddRange(new object[] {
"ramya",
"lakshmiramya",
"abcdefghijklmnopqrstuvwxyz",
"abcdefghijklm",
"abcdefghijklmraqeewf",
"yxwvutsrqponmlkjihgf",
"zyxwvutsrqponmlkjihgfedcba"});
this.comboBox1.Location = new System.Drawing.Point(64, 56);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 0;
this.comboBox1.Text = "comboBox1";
this.toolTip1.SetToolTip(comboBox1,comboBox1.Text);
this.comboBox1.MouseHover += new System.EventHandler(this.comboBox1_MouseHover);
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// toolTip1
//
this.toolTip1.AutoPopDelay = 0;
this.toolTip1.InitialDelay = 0;
this.toolTip1.ReshowDelay = 0;
this.toolTip1.ShowAlways = true;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.comboBox1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
toolTip1.SetToolTip(comboBox1,comboBox1.SelectedItem.ToString());
}
private void comboBox1_MouseHover(object sender, EventArgs e)
{
MessageBox.Show(comboBox1.SelectedText);
}
}
}