Reputation: 123
I have created a grid function using list control. There are two columns in the list. Data and NAME.
The user should select a file; and the data inside the file should be diplayed in first column "DATA" and file name should be displayed in the 2nd column "NAME". I have written a code but nothing is appearing in the list
CFileFind finder;
bool bFound;
CString filename = "C:\\ Location\\*.txt";
bFound = finder.FindFile(filename);
if(bFound)
{
while(bFound)
{
bFound = finder.FindNextFile();
if(bFound)
{
m_List.AddString(finder.GetFileName()); //This is where the actual data is added
}
}
CStdioFile files;
CFileException exp;
CString strLine;
if (files.Open(filename, CFile::modeRead, &exp))
{
while(files.ReadString(strLine)){}
}
}
void CuserspecificationDlg::InsertItems()
{
HWND hWnd = ::GetDlgItem(m_hWnd, IDC_LIST1);
// Set the LVCOLUMN structure with the required
// column information
..
..
SetCell(hWnd,out,1,1); // where out is the Cstring variable for edit control
}
What can be the mistake?
Upvotes: 1
Views: 1521
Reputation: 5331
Please see a tutorial on how to use List box here. You could define a member variable of type CListBox that is mapped to your list box via the control wizard.
Upvotes: 2