请高手演示vb ListView导入ACCESS数据库
请高手给我发个vblistview导入access数据库的演示视频,谢谢了,好使的追加分数。最好是做一个视频o(∩_∩)o...哈哈这样我猜能明白本人愚钝...
请高手给我发个vb listview导入access数据库的演示视频,谢谢了,好使的追加分数。
最好是做一个视频 o(∩_∩)o...哈哈 这样我猜能明白 本人愚钝 展开
最好是做一个视频 o(∩_∩)o...哈哈 这样我猜能明白 本人愚钝 展开
2个回答
展开全部
已经发了个小例子到你邮箱....
视频是没有了.可以讲一下.
先调用一个listview,一个imagelist,imagelist右键属性把图标加上,listview右键设置属性,"通用"里是设置网格样式的。一般把"网格行"勾上.在图象列表里选择imagelist.用我的一个程序里部分语句演示一下:
1)在设置表格和在表格里显示数据
2)单击表头排序号
3)双击选定行弹出其他窗口
1)form_load 里加语句:
'添加listview1标头、宽度~~~~~~~~~~~~~~~~~~~~~`
With ListView1
.View = lvwReport
.ColumnHeaders.Add = "客户编号"
.ColumnHeaders.Add = "应用方式"
.ColumnHeaders.Add = "软件提供商"
.ColumnHeaders.Add = "购买日期"
.ColumnHeaders.Add = "投入金额"
.ColumnHeaders.Add = "应用效果"
'--------------设置每行宽度
.ColumnHeaders(1).Width = 1500
.ColumnHeaders(2).Width = 1500
.ColumnHeaders(3).Width = 1500
.ColumnHeaders(4).Width = 1500
.ColumnHeaders(5).Width = 1500
End With
'添加listview1数据~~~~~~~~~~~~~~~~~~~~~~
Call OpenConn
sql = "select * from yingyong where 客户编号='" & yhxhcd & "' ORDER BY 应用"
rs.Open sql, cn, 1, 1 Do While Not rs.EOF
Set addlist1 = ListView1.ListItems.Add(, , rs.Fields("客户编号"), , 1) '将各项数据加入list列表
addlist1.SubItems(1) = IIf(IsNull(rs.Fields("应用")), "", rs.Fields("应用"))
addlist1.SubItems(2) = IIf(IsNull(rs.Fields("软件供应商")), "", rs.Fields("软件供应商"))
addlist1.SubItems(3) = IIf(IsNull(rs.Fields("购买日期")), "", rs.Fields("购买日期"))
addlist1.SubItems(4) = IIf(IsNull(rs.Fields("投入金额")), "", rs.Fields("投入金额"))
addlist1.SubItems(5) = IIf(IsNull(rs.Fields("应用效果")), "", rs.Fields("应用效果"))
rs.MoveNext
Loop
Call CloseConn
End Sub
-----------------------------------------------
2)'listview1点击列标头排序功能~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
With ListView1
If (ColumnHeader.Index - 1) = .SortKey Then
.SortOrder = (.SortOrder + 1) Mod 2
Else
.Sorted = False
.SortOrder = 0
.SortKey = ColumnHeader.Index - 1
.Sorted = True
End If
End With
--------------------------------------
3)双击选定行弹出其他窗口
Private Sub ListView1_DblClick()
If ListView1.ListItems.Count <= 0 Then Exit Sub
ctmc = "企业信息化应用情况"
yingyong = ListView1.SelectedItem.SubItems(1)
pd = False
Formyy.Show 1
End Sub
---------------------------------
OpenConn 和 CloseConn是在模板里定义的.当然你也可以在这里面直接用.不用call
Public Sub OpenConn()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\客户信息.mdb"
End Sub
'关闭数据库连接
Public Sub CloseConn()
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
视频是没有了.可以讲一下.
先调用一个listview,一个imagelist,imagelist右键属性把图标加上,listview右键设置属性,"通用"里是设置网格样式的。一般把"网格行"勾上.在图象列表里选择imagelist.用我的一个程序里部分语句演示一下:
1)在设置表格和在表格里显示数据
2)单击表头排序号
3)双击选定行弹出其他窗口
1)form_load 里加语句:
'添加listview1标头、宽度~~~~~~~~~~~~~~~~~~~~~`
With ListView1
.View = lvwReport
.ColumnHeaders.Add = "客户编号"
.ColumnHeaders.Add = "应用方式"
.ColumnHeaders.Add = "软件提供商"
.ColumnHeaders.Add = "购买日期"
.ColumnHeaders.Add = "投入金额"
.ColumnHeaders.Add = "应用效果"
'--------------设置每行宽度
.ColumnHeaders(1).Width = 1500
.ColumnHeaders(2).Width = 1500
.ColumnHeaders(3).Width = 1500
.ColumnHeaders(4).Width = 1500
.ColumnHeaders(5).Width = 1500
End With
'添加listview1数据~~~~~~~~~~~~~~~~~~~~~~
Call OpenConn
sql = "select * from yingyong where 客户编号='" & yhxhcd & "' ORDER BY 应用"
rs.Open sql, cn, 1, 1 Do While Not rs.EOF
Set addlist1 = ListView1.ListItems.Add(, , rs.Fields("客户编号"), , 1) '将各项数据加入list列表
addlist1.SubItems(1) = IIf(IsNull(rs.Fields("应用")), "", rs.Fields("应用"))
addlist1.SubItems(2) = IIf(IsNull(rs.Fields("软件供应商")), "", rs.Fields("软件供应商"))
addlist1.SubItems(3) = IIf(IsNull(rs.Fields("购买日期")), "", rs.Fields("购买日期"))
addlist1.SubItems(4) = IIf(IsNull(rs.Fields("投入金额")), "", rs.Fields("投入金额"))
addlist1.SubItems(5) = IIf(IsNull(rs.Fields("应用效果")), "", rs.Fields("应用效果"))
rs.MoveNext
Loop
Call CloseConn
End Sub
-----------------------------------------------
2)'listview1点击列标头排序功能~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
With ListView1
If (ColumnHeader.Index - 1) = .SortKey Then
.SortOrder = (.SortOrder + 1) Mod 2
Else
.Sorted = False
.SortOrder = 0
.SortKey = ColumnHeader.Index - 1
.Sorted = True
End If
End With
--------------------------------------
3)双击选定行弹出其他窗口
Private Sub ListView1_DblClick()
If ListView1.ListItems.Count <= 0 Then Exit Sub
ctmc = "企业信息化应用情况"
yingyong = ListView1.SelectedItem.SubItems(1)
pd = False
Formyy.Show 1
End Sub
---------------------------------
OpenConn 和 CloseConn是在模板里定义的.当然你也可以在这里面直接用.不用call
Public Sub OpenConn()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\客户信息.mdb"
End Sub
'关闭数据库连接
Public Sub CloseConn()
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询