Results 1 to 6 of 6

Thread: Listbox & Edit Box # Simple ?'s

  1. #1

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335

    Listbox & Edit Box # Simple ?'s

    How do i add text to a listbox in a MFC program and how do i get the selected Item from a listbox and also how do i get text from a edit control.

    To summarize;
    1: Add Char to listbox
    2: Get Char from listbox
    3: Get text or char from edit box
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    1) CListBox::AddString, CListBox::InsertString

    2) CListBox::GetCurSel, CListBox::GetSelCount, CListBox::GetSelItems, CListBox::GetSel

    3) CEdit::GetWindowText
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    what if i have 2 listboxes?

    i tried
    VB Code:
    1. CListBox::AddString (buffer);
    but ended up with a error
    VB Code:
    1. E:\Program Files\Microsoft Visual Studio\MyProjects\ClipboardT1\ClipboardT1Dlg.cpp(189) : error C2352: 'CListBox::AddString' : illegal call of non-static member function
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  4. #4

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    OK now im trying to program in Win32 but i tried this and it dont work which means i did something wronge.
    VB Code:
    1. char *sBuf = "";
    2. int iList;
    3.                                
    4.           iList = ::GetWindowTextLength(list);
    5.  
    6.                ::GetWindowText(list,sBuf,iList);
    7.                ::SetWindowText(edit,sBuf);

    What im trying to do is obvious (lol if i could spell it ) Im trying to get the selected item in the listbox to goto a edit box.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I meant to call these functions. Of course, since they're methods, you need an instance of those classes.
    Code:
    CListBox lb1, lb2;
    // ...
    lb1.AddString("Hello");
    lb2.AddString("Hi");
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    see thats helps thanks
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

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