Link to home
Start Free TrialLog in
Avatar of gem56
gem56

asked on

ToolTip doesn't work for UserControl

Hi,
I have a project with some Forms and also UserControls. In the Forms ToolTips pop up but not for UserControls. I believe that I've done everything the same (as there's not much to do, i.e. add ToolTip control to a Form/UseControl and add text to different Form controls).

Should I be doing something more for UserControls than for standard Foms?

/Michael
Avatar of administradores
administradores

No, just drag a ToolTip over the Usercontrol and then fill the tooltip text boxes on each control, but i think you have done that.

Try to make a stand-alone project to reproduce the same error.
Avatar of AkisC
Lets say your Tooltip is named TT1
If there is a ToolTip on TT1 property on your Usercontrol then set the value there
If you have done that and is not working try (On form_Load)
   TT1.AutoPopDelay = 5000
   TT1.InitialDelay = 1000
   TT1.ReshowDelay = 500
   TT1.ShowAlways = True
   TT1.IsBalloon = True
   ' Set up the ToolTip text for ...
   TT1.SetToolTip(youUserControl, "This Is the ToolTip")


Hi!

Try to set the tooltip on UserControl_Load:

Private Sub UserControl1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ToolTip1.SetToolTip(Button1, "Test")  'Here controls name is button1
   End Sub

Matti
Avatar of gem56

ASKER

Thanks for all the suggestions.
I've just had some other issues to deal with and I couldn't try the suggestions but I will in the morning, as it's getting very late here.

/Michael
Hi gem56

Could you work out your issues? i hope so, if not don't hesitate to ask.
Avatar of gem56

ASKER

Hi guys,
Sorry for not getting back to this sooner, I had other issues take a bit longer than anticipated.

I've tried all your suggestions with mixed luck. No matter what I tried in the original project I just couldn't it working. I then created a new temp project and tried various combinations and guess what (not) it worked every time. So then I used that new UserControl in my original project and guess what (again) it didn't work.

Obviously I'm doing something in my original project that I'm not doing in the new temp project. Obviously I'll keep plugging away and any further suggestions would be most welcome.

/Michael
Did any of the suggestions here worked in your temp project?
   If yes=>award points, If no=>ask the moderators to delete the question.
   Either yes -or- no close the question and open anotherone with the new problem.
Have fun coding...
Avatar of gem56

ASKER

Hi AkisC,
My original problem is that ToolTip doesn't work in my project, and that still remains the case. The part I said worked was me creating a new/Temp project and seeing whether it works there. Seeing it works in the new project however only confirms that I have something wrong in my (original) project.

I've done a bit more digging (on the original project) and have found that ToolTip works on simple Button controls of some Forms but not on other Forms (without even using UserControls). That's a simpler scenario than the initial so I'll follow that path and hope it leads me to a solution or at least to being able to give you guys more info.

/Michael
Avatar of gem56

ASKER

I have a further bit of info and a few less hairs on my head.

I've found the problem to be due to setting the Forms MdiParent property. If I leave that property set to Nothing then ToolTip works but not my MDI mechanism.

Any ideas how I can have both working?

/Michael
Avatar of gem56

ASKER

I'm now even more confused than before.

As per my previous post, in the main project when I leave MdiParent property set to Nothing the ToolTip function works but I just found that in my temp project I can set the MdiParent property to the Main form and it still works so I'm basically back to square one.

Any thoughts?
Hi. Sorry I missed your comments. My internet connection was down for some time.
So as you discribe, you have to deal with microsoft software...
When I find peculiar behavior of forms or controls the first thing I do (for years now) I delete my form or control (keep the code of course) then I save my project, exit the MS programm, then re-open all and re-create the form or control, giving it a new name (if possible {few lines of code to change...})
This has saved me lots of working time, times-and-again...

Take care
Avatar of gem56

ASKER

Thanks for that.
I'm focusing on something at the moment but will try your suggestion as soon as I get a chance and let you know how I went.

/Michael
Hi TheLearnedOne
Happy New Year!
We all try to help here, but if there is not a follow up then we can not focus to the real problem.
I think that [administradores] has given the corrcet direction to the solution.
Avatar of gem56

ASKER

Hi AkisC and TheLearnedOne,
Once again my apology for not coming back to you on this question sooner, it's not through lack of appreciation but lack of time and frustration at not having any luck every time I do get back to it.

This is the current state (for your info):
I created a new MDI project with several Panels and UserControl that had a few controls and the ToolTip function worked as expected. I then copied that UserControl to my main project and added it to a Panel control in one window and the function didn't work.

I then copied one of my (main project) UserControls to the newly created MDI project (but without any Form code) and the ToolTip function worked. I then added the Form code but didn't set Form.MdiParent property and the ToolTip function worked. I then set the Form.MdiParent property and the (ToolTip) function stopped working.

MY CONCLUSION: The fact that setting Form.MdiParent property in the new project didn't have any adverse effects on the ToolTip function but it does in my main project, I'm still confused. As this question has dragged on and I'm unable to give you any additional info to give you a chance at helping me it's unfair to keep the question open so I agree that it's best to close it as suggested and I'll just plough away at it when I get a chance or new ideas.

Thanks for your input and sorry for (perhaps) appearing ungrateful.

Cheers,
     Michael
Hi gem56
I understand what you wrote. There are times that I just leave a moinor problem and continue with the rest of the work. As you wrote "I agree that it's best to close it as suggested"
Happy new year!
Avatar of gem56

ASKER

Hi guys,
It appears that I've identified the cause of my problem, it's the use of Visual Basic PowerPacks v2.0 shapes.

If I use a LineShape, OvalShape or RectangleShape from the Visual Basic PowerPacks v2.0 in my MDI Container Form then ToolTp stops working but as soon as I remove all of the shapes from the MDI Container form then ToolTip function starts working properly. I've repeated the exercise several times and the same happens every time. I've already had some problems with Visual Basic PowerPacks shapes so I guess this is another one although I don't know if there's a workaround for this one.

Obviously any suggestions would be most appreciated prior to the question being closed, as per above.

/Michael

ASKER CERTIFIED SOLUTION
Avatar of gem56
gem56

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Closed, 250 points refunded.
Vee_Mod
Community Support Moderator
gem56 says "I created a new MDI project " 
and djifrear in tektip states As a side note, if this is a new project you can start a new MDI Project and have Visual Studio create a good template for you, including the menu's and buttons to cascade and arrange the windows.

But In VS 2005 and 2008 I do not see any option in create new projects to create "MDI project"  
You can create a windows application and set the IsMDIContainer property on the initial default form to be true, but I have not seen any way to "create MDI Project"
Is this a template that exist in VS or was djifrear talking about making a user generated template.