一个简单的问题 在线等!! 用vc采集数据,然后存入access数据库,然后能够在vc里整行的显示数据库里的数据,请问用应该用啥子方法比较好,要不要下专门的vc控件?请高手指教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用普通List Control控件可以了.while(条件){ 读数据项; listcontrol.InsertItem(行,数据项); 读数据项; listcontrol.SetItemText(行,列,数据项)} m_List.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT, rect, this, 1); m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP); m_List.SetBkColor(RGB(125,30,200)); m_List.SetTextBkColor(RGB(0,0,255)); m_List.InsertColumn(0, "图书名称"); m_List.InsertColumn(1, "图书ISBN"); m_List.InsertColumn(2, "价钱"); m_List.InsertColumn(3, "出版社"); m_List.InsertColumn(4, "进馆日期"); m_List.InsertColumn(5, "总数量"); m_List.InsertColumn(6, "在馆数量"); m_List.SetColumnWidth(0, nWidth/7); m_List.SetColumnWidth(1, nWidth/7); m_List.SetColumnWidth(2, nWidth/7); m_List.SetColumnWidth(3, nWidth/7); m_List.SetColumnWidth(4, nWidth/7); m_List.SetColumnWidth(5, nWidth/7); m_List.SetColumnWidth(6, nWidth/7); theApp.ADOExcute(theApp.m_Set, strSql); int nCount; nCount = theApp.m_Set->GetRecordCount(); if(nCount > 0) { theApp.m_Set->MoveFirst(); int i =0 ; while(!theApp.m_Set->EndOfFile) { _variant_t result; CString str; result = theApp.m_Set->GetCollect("book_name"); str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal; m_List.InsertItem(i, str); result = theApp.m_Set->GetCollect("book_ISBN"); str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal; m_List.SetItemText(i, 1, str); result = theApp.m_Set->GetCollect("book_price"); str.Format("%.2f", result.dblVal); m_List.SetItemText(i, 2, str); result = theApp.m_Set->GetCollect("book_public"); str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal; m_List.SetItemText(i, 3, str); result = theApp.m_Set->GetCollect("book_intodate"); m_dTime = result; str = m_dTime.Format("%Y-%m-%d"); m_List.SetItemText(i, 4, str); result = theApp.m_Set->GetCollect("book_Size"); str.Format("%d", result.intVal); m_List.SetItemText(i, 5, str); result = theApp.m_Set->GetCollect("book_AtSize"); str.Format("%d", result.intVal); m_List.SetItemText(i, 6, str); theApp.m_Set->MoveNext(); i++; } } 同意楼上的,用listctrl就足够了 ShowWindow和UpdateWindow,仍然不明了 今天是七.七事变69周年,国人进! 有人知道如何拦载一个打开的串口正在传送的数据吗? 台湾国旗设计大赛。。。。。晕了。 编一个比较大的程序,如何管理? VC中调用EXCEL宏的问题(请教) cannot find the definition (implementation)of the function CreateDIBPatternBrush或CreateDIBPatternBrushPt函数的第一个参数应是什么结构的指针?在线 请教关于combo box的问题! 内存数据压缩问题 test 求多进(线)程程序例子
读数据项;
listcontrol.InsertItem(行,数据项);
读数据项;
listcontrol.SetItemText(行,列,数据项)
}
m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP);
m_List.SetBkColor(RGB(125,30,200));
m_List.SetTextBkColor(RGB(0,0,255)); m_List.InsertColumn(0, "图书名称");
m_List.InsertColumn(1, "图书ISBN");
m_List.InsertColumn(2, "价钱");
m_List.InsertColumn(3, "出版社");
m_List.InsertColumn(4, "进馆日期");
m_List.InsertColumn(5, "总数量");
m_List.InsertColumn(6, "在馆数量"); m_List.SetColumnWidth(0, nWidth/7);
m_List.SetColumnWidth(1, nWidth/7);
m_List.SetColumnWidth(2, nWidth/7);
m_List.SetColumnWidth(3, nWidth/7);
m_List.SetColumnWidth(4, nWidth/7);
m_List.SetColumnWidth(5, nWidth/7);
m_List.SetColumnWidth(6, nWidth/7); theApp.ADOExcute(theApp.m_Set, strSql); int nCount;
nCount = theApp.m_Set->GetRecordCount();
if(nCount > 0)
{
theApp.m_Set->MoveFirst(); int i =0 ; while(!theApp.m_Set->EndOfFile)
{
_variant_t result;
CString str; result = theApp.m_Set->GetCollect("book_name");
str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal;
m_List.InsertItem(i, str); result = theApp.m_Set->GetCollect("book_ISBN");
str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal;
m_List.SetItemText(i, 1, str); result = theApp.m_Set->GetCollect("book_price");
str.Format("%.2f", result.dblVal);
m_List.SetItemText(i, 2, str); result = theApp.m_Set->GetCollect("book_public");
str = (result.vt == NULL)? "" :(char *)(_bstr_t)result.bstrVal;
m_List.SetItemText(i, 3, str); result = theApp.m_Set->GetCollect("book_intodate");
m_dTime = result;
str = m_dTime.Format("%Y-%m-%d");
m_List.SetItemText(i, 4, str); result = theApp.m_Set->GetCollect("book_Size");
str.Format("%d", result.intVal);
m_List.SetItemText(i, 5, str); result = theApp.m_Set->GetCollect("book_AtSize");
str.Format("%d", result.intVal);
m_List.SetItemText(i, 6, str); theApp.m_Set->MoveNext();
i++;
}
}