views:

43

answers:

3

I have form with 4 buttons and Image. For all these controls i have added tool tip by using the following code

 ToolTip objToolTip=null;
    .....
    public Form1()
    {
        objToolTip=new ToolTip();
    }
    .....
    //Used to set the button lables based on Data from database
    private void SetButtonlabels()
    {
        objToolTip.SetToolTip(btnSAPConnect, "Connects to SAP");
    }

the problem is, Once the form is opened, the tool tips are not coming immediately even if we move our mouse over the control. But Once i click on the form, then tool tips are working properly. I am not sure which is causing the problem.

Can anybody please help to fix this issue.

A: 

In wich method you call SetButtonlabels()?

Try to call it after the initialization of the form.

alfdev
I am calling this method on Form Load.
Dinesh
A: 

call SetButtonlabels() from constructor of form1

Khaniya
+2  A: 

You said this:

Once the form is opened, the tool tips are not coming immediately even if we move our mouse over the control. But Once i click on the form, then tool tips are working properly.

This leads me to think it's standard windows behaviour, and that your form just isn't getting focus when you open it. Tooltips in many apps will only work if their parent window is activated.

Dan Puzey
i have tried with activating the window. I have used the following code "objForm.Activate()". But still it's behaving the same.
Dinesh
+1 I agree that's the reason. The form got focused after OP's click so the tooltip is working since then.
Danny Chen
@Dinesh: Posting the full code to your form might help, in that case.
Dan Puzey