CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: combobox help

  1. #1
    Join Date
    Jun 2001
    Posts
    126

    combobox help

    I have a combobox full of usernames. I wish to get the currently selected username (as a CString NOT the index of the string in the list because the contents of the list change at runtime and I will not know what names are in the list) so that I can perform actions on the CString. Currently I am having to use a
    CStringArray to hold the same names as the combobox, grabbing the index of the current selection, and then getting the username at that index in the CStringArray. There must be an easier, more efficient way, but I am lost to it. GetDlgItemText(...) caught my eye in MSDN, but I don't know if it does what I want or how to use it. Could someone impart some wisdom?
    Thanks


  2. #2
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,725

    Re: combobox help

    ComboBox has a class member you can use :

    CComboBox::GetLBText

    int GetLBText( int nIndex, LPTSTR lpszText ) const;

    void GetLBText( int nIndex, CString& rString ) const;




  3. #3
    Join Date
    Jun 2001
    Posts
    126

    Re: combobox help

    Perfect! I appreciate the help with silly little things like this. Thank you.


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