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
Printable View
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
1) CListBox::AddString, CListBox::InsertString
2) CListBox::GetCurSel, CListBox::GetSelCount, CListBox::GetSelItems, CListBox::GetSel
3) CEdit::GetWindowText
what if i have 2 listboxes?
i triedbut ended up with a errorVB Code:
CListBox::AddString (buffer);
VB Code:
E:\Program Files\Microsoft Visual Studio\MyProjects\ClipboardT1\ClipboardT1Dlg.cpp(189) : error C2352: 'CListBox::AddString' : illegal call of non-static member function
OK now im trying to program in Win32 but i tried this and it dont work which means i did something wronge.
VB Code:
char *sBuf = ""; int iList; iList = ::GetWindowTextLength(list); ::GetWindowText(list,sBuf,iList); ::SetWindowText(edit,sBuf);
What im trying to do is obvious (lol if i could spell it :D ) Im trying to get the selected item in the listbox to goto a edit box.
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");
see thats helps thanks