.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Show Tooltip in Textbox

Posted By: Santosh     Posted Date: May 03, 2010    Points:2   Category :VB.Net
Can any body plz tell me
how to set ToolTip in KeyPress of a Textbox.

Ex:Let a Textbox is txtSalary ,when i will type anything in that textbox it should show a tooltip like("Salary should ne Decimal Only")

which event i need to write the code to show the toltip


Author: Lalij Mer             
Posted Date: May 03, 2010     Points: 5   

You can try something like this:

<asp:TextBox ID="TextBox1" runat="server" Width="50px" ToolTip="" onkeydown="keyPress(event);" ></asp:TextBox>

The keyPress event in JavaScript looks like this:

<script type="text/Javascript">
function keyPress(evt)
if(evt.which || evt.keyCode)
if((evt.which == 13) || (evt.keyCode == 13))
location = document.getElementById('<% =Button1.ClientID %>').href;
return false;
return true;

Please Check my answer if you help....
Thank You...

Author: Santosh             
Posted Date: May 03, 2010     Points: 5   

hi Lalit

i am working on vb.net
plz give me vb.net code for setting tooltip in text box keypress.


Author: BangaruBabuPureti             
Posted Date: May 13, 2010     Points: 5   

ToolTip toolTip1 = new ToolTip();

// Set up the delays for the ToolTip.
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
// Force the ToolTip text to be displayed whether or not the form is active.
toolTip1.ShowAlways = true;

// Set up the ToolTip text for the Button and TextBox.
toolTip1.SetToolTip(this.button1, "My Buton");
toolTip1.SetToolTip(this.Textbox1, "My TextBox");

BangaruBabu Pureti

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend