CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    May 1999
    Posts
    15

    [VC++6.0] A Problem About Create ComboBox

    Hi,
    I bulid a dialog box and add a combo box (m_try) by resource editor. And add this code in dialog's OnInitDialog():
    m_try.AddString("Hello");
    But the string "Hello" can't appear in the listbox.
    Now I change the way to add this combo box: I type "CComboBox m_try" by myself in dialog class amd use m_try.Create() to create this combo box.
    Now m_try.AddString("Hello") works well.
    What's difference between the tow way? Thanks!


  2. #2
    Join Date
    Apr 1999
    Location
    SungNam KyungKi Korea
    Posts
    14

    Re: [VC++6.0] A Problem About Create ComboBox

    maybe,
    I wonder,
    when you made a member-variable, m_try, for combo-box in Class-Wizard,
    you set the category with 'Value'
    Convert it to 'Control'


    by nfuox

  3. #3
    Join Date
    May 1999
    Posts
    42

    Re: [VC++6.0] A Problem About Create ComboBox

    In addition to tchung's reply, be sure you call m_try.SetCurSel(0) to set the current selection to the string you added.


  4. #4
    Join Date
    May 1999
    Posts
    15

    Re: [VC++6.0] A Problem About Create ComboBox

    Thanks for Bob and tchung's answers! Now I can see the string which add by AddString() in the edit box of CComboBox.
    But the string can't appear in the list box of CComboBox. The m_try's category is Control now,
    and the ComboBox's type is drop-down.
    The InitStorage() is also useless. Do you have any idea for this probelm? Thanks!


  5. #5
    Join Date
    Apr 1999
    Location
    SungNam KyungKi Korea
    Posts
    14

    Re: [VC++6.0] A Problem About Create ComboBox

    Enlarge your combo-box More to down-side!


    by nfuox

  6. #6
    Join Date
    May 1999
    Posts
    15

    Re: [VC++6.0] A Problem About Create ComboBox

    If I create a ComboBox in dialog by myself, I can use m_try.Create() to fix the size of drop-down side. But while a ComboBox is alreay a member of the dialog, I needn't(can't) use Create() to create it. What method can I use to change the size of a ComboBox? Thanks!


  7. #7
    Join Date
    May 1999
    Location
    Sydney, Australia
    Posts
    420

    Re: [VC++6.0] A Problem About Create ComboBox

    in resourec editor, click on the combobox's arrow on the right of the combobox, then you can adjust the drop...

    Sally


  8. #8
    Join Date
    May 1999
    Posts
    15

    Re: [VC++6.0] A Problem About Create ComboBox

    Thanks! This method works well.


  9. #9
    Join Date
    Apr 1999
    Location
    SungNam KyungKi Korea
    Posts
    14

    Re: [VC++6.0] A Problem About Create ComboBox

    When you create a CComboBox, you can adjust the Size of combo-box with some parameters.


    m_try.Create(CBS_AUTOHSCROLL,CRect(10,10,150,150),this,101010);
    m_try.ShowWindow(SW_SHOW);
    m_try.AddString("Korea");
    m_try.AddString("USA");
    :
    m_try.SetCurSel(0);





    Sorry, But I did my best!


    by nfuox

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured