Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how to display text on combo box

jubi1eejubi1ee Member Posts: 13
Hello,

I have searched through ProgrammersHeaven on 'combo box' with C#. No luck. Searched on google and still can't find the information that I need.

I am programming C# for a Pocket PC. The GUI has a drop down combo box. What I want to achieve is to display a text once the GUI finishes loading. The text can be 'Select Menu'.

My problem is, once the GUI finishes loading, a text value doesn't show up unless I click on the drop down menu.

How would I display this initial text value such as 'Select Menu' when the form finishes loading?

Any help would be appreciated.

Thanks,
j

Comments

  • adi_clepceaadi_clepcea Member Posts: 4
    Hi,

    I don't know if this is the best solution, and if it works on a Pocket PC, but ....

    You could add an event handler for the form.activated evnet of your form(that's the for your combo box is on). If the form is called frmMyForm you will have something like this:

    ***************************
    frmMyForm.Activated += new EventHandler(frmMyForm_Activated);
    ***************************

    and you should then add a procedure in your class:

    ***************************
    public void frmMyForm_Activated(object sender, EventArgs e){
    cmbBox.SelectedItem="Select menu";
    }
    ***************************

    The activated event takes place each time the form is activated, so if you want the combobox not to show 'Select menu' each time you return to your form from some other form, you should use an boolean value to check if the event allready took place.

    HTH
    Adi


    : Hello,
    :
    : I have searched through ProgrammersHeaven on 'combo box' with C#. No luck. Searched on google and still can't find the information that I need.
    :
    : I am programming C# for a Pocket PC. The GUI has a drop down combo box. What I want to achieve is to display a text once the GUI finishes loading. The text can be 'Select Menu'.
    :
    : My problem is, once the GUI finishes loading, a text value doesn't show up unless I click on the drop down menu.
    :
    : How would I display this initial text value such as 'Select Menu' when the form finishes loading?
    :
    : Any help would be appreciated.
    :
    : Thanks,
    : j
    :

Sign In or Register to comment.