Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VB.NET ToolTip Not Showing

Posted on 2010-09-17
18
1,144 Views
Last Modified: 2013-11-26

Hi

I have an MDI Application and I show another form from a dropdown menu as follows:

   Dim MyForm As New FrmMyForm
   MyForm.MDIParent = Me
   MyForm.Show

FrmMyForm has a ToolTip control in its Component Tray. I use the appropriate ToolTip Property of a Button Control and insert the necessary text representing the ToolTip. When I run the application and hover the mouse over the Button control, the Tooltip does not display.

Any idea what I can be doing wrong.

Thanks
0
Comment
Question by:Nolanc
18 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 33699188
Just Drag a Tooltip from the toolbox on you windows form and write the following code in code behind file.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseHover
        ToolTip1.SetToolTip(Button1, "sometext")

    End Sub
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33699221
He can Put Your Code (@Dhaest)  also in his FrmMyForm Load Event
0
 

Author Comment

by:Nolanc
ID: 33699413
Hi Dhaest

I am not sure what you mean by the "Code Behind File". However I used your code but instead of the Button_Click Event I used the Button_MouseHover Event. It works, but the ToolTip just flashes and dies. In other words there is no delay. I have the AutoPopDelay set to 5000. Even if I increase it, the Tooltip just flashes by (like a flash of lightning).
Any further ideas.
Thanks
0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33699422
did you try in from load event?
0
 

Author Comment

by:Nolanc
ID: 33699505

Hi

I tried this code in the form Load Event as you suggested (because I thought it would be much less work for me).

ToolTip1.SetToolTip(Button1, "sometext")

There is no evidence at all of the ToolTip when I hover the Mouse over the Button.

Thanks
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33699589
Where do you put your tooltip?

you should add a tooltip also in your FrmMyForm design to have a tooltip text in your button
0
 

Author Comment

by:Nolanc
ID: 33699769
Hi itoutou

I think I have mentioned that I dragged a ToolTip control from the ToolBox onto FrmMyForm and it sits in the Component Tray of FrmMyForm. Lets call it MyToolTips. I hope I am responding correctly to your last comment.
Thanks.
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33699801
yes you are...
 Private Sub FrmMyForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.ToolTip1.SetToolTip(Button1, "i am a tooltipMessage")
End sub
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33699809
just for testing purposes try :
Private Sub FrmMyForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 Me.ToolTip1.IsBalloon = True  
 Me.ToolTip1.SetToolTip(Button1, "i am a tooltipMessage")
End sub
0
 
LVL 29

Expert Comment

by:nffvrxqgrcfqvvc
ID: 33699821
You might want to just confirm that you can start a new project add a tooltip control and a button to the form. See if the tooltip appears...
If you see the tooltip in the simple project you just made it's something else in your project affecting the tooltip behavior.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ToolTip1.SetToolTip(Me.Button1, "My Tooltiptext")
    End Sub

Open in new window

0
 

Author Comment

by:Nolanc
ID: 33700092

Hi

In my initial problem statement, I provided the following code:

   Dim MyForm As New FrmMyForm
   MyForm.MDIParent = Me   (A)
   MyForm.Show

It is the line of code in (A) that is causing the ToolTip Control in FrmMyForm to misbehave. When I comment that line, all is well. However, when FrmMyForm is displayed and I click on any Menu Item of the MDI Form, then FrmMyForm is minimized . So I corrected an instance of misbehaviour and created another unique instance of misbehaviour.

Do you have any ideas or shall I close this question and create another.

Thanks
 
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33700126
ususally the mdi parent use this :
 Dim ChildForm As New yourformname
        ' Make it a child of this MDI form before showing it.
        ChildForm.MdiParent = Me

        m_ChildFormNumber += 1
        ChildForm.Text = "Window " & m_ChildFormNumber

        ChildForm.Show()

with one you will not have a problem
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33700209
it is another subject   but just keep this function when you are using mdi parent

 Private Function IsOpen(ByVal nameForm As String) As Boolean
        Dim childfrm As Form
        Dim strName As String
        Dim intLastIndex As Integer

        For Each childfrm In Me.MdiChildren
            strName = childfrm.GetType.ToString
            intLastIndex = strName.LastIndexOf(".")
            strName = Mid(strName, intLastIndex + 2, Len(strName) - intLastIndex)
            If LCase(strName) = LCase(nameForm) Then
                childfrm.BringToFront()
                Return True
            End If
        Next
        Return False
    End Function


Private Sub ShowNewForm(ByVal sender As Object, ByVal e As EventArgs) Handles NewToolStripMenuItem.Click, NewToolStripButton.Click
        If blnActive = IsOpen("YourFormName") Then
            Dim MyForm As New YoutFormName
            MyForm.WindowState = FormWindowState.Normal
            MyForm.MdiParent = Me
            
            MyForm.StartPosition = FormStartPosition.CenterScreen
            MyForm.Show()
         End if
End Sub

Open in new window

0
 

Author Comment

by:Nolanc
ID: 33700225
Hi itoutou

I have tried this code, but m_ChildFormNumber is being underlined (presumably not defined).

Thanks
0
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33700251
sorry i forgot
 Private blnActive As Boolean
0
 

Author Comment

by:Nolanc
ID: 33700665
Hi itoutou

I have copied your code into my MDIForm but am battling to understand it. I would like to try it though.

Can you please explain the following to me:

1. How is the Sub Procedure activated. I notice that "Handles" references more than one event. The First being the Menu Item I click. I am not sure what the other event is all about because I have to substiitute something for it viz. NewToolStripButton.Click

I would love to know how it works before I try it.

Thanks
0
 
LVL 18

Accepted Solution

by:
John (Yiannis) Toutountzoglou earned 100 total points
ID: 33700869
It is an example .....just put it in your button click sub
0
 

Author Closing Comment

by:Nolanc
ID: 33701039
Thanks for the ideas.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question