FileListBox的问题~~~100分~~

hudingchen 2006-02-14 03:09:30
我想在FileListBox中画表格或线来显示多个列,应该怎么做?例如在FileListBox显示如下的结果:

姓名 学校 编号 分数
aaa aaa aaaa aaa
bbb bbb cccc bbb



...全文
132 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyl910 2006-02-14
  • 打赏
  • 举报
回复
同意rainstormmaster(暴风雨 v2.0)


用listbox也可以

vbTab是分栏字符
List1.Add "aaa" & vbTab "aaa" & vbTab "aaaa" & vbTab "aaa"

分栏的精确定位可以发送LB_SETTABSTOPS消息
rainstormmaster 2006-02-14
  • 打赏
  • 举报
回复
用listbox也可以
ZOU_SEAFARER 2006-02-14
  • 打赏
  • 举报
回复
用listview 来显示你的要求


Option Explicit

Dim intX As Integer ' Counter variable.
Dim Val As Recordset
Dim Max As Integer
Dim Totel As Integer

Private Sub Combo1_Click()

ListView1.View = Combo1.ListIndex
End Sub

Private Sub Command1_Click()
Me.ProgressBar1.Max = Data1.Recordset.RecordCount
Totel = Data1.Recordset.RecordCount
Data1.Caption = Totel
Set Val = Data1.Recordset
Do While Val.EOF = False
Max = Max + 1
Me.ProgressBar1.Value = Max
With ListView1.ListItems.Add()
For intX = 0 To 4
If intX = 0 Then
.Text = Data1.Recordset.Fields(0).Value
Else
.SubItems(intX) = Data1.Recordset.Fields(intX).Value
End If
Next
Data1.Recordset.MoveNext
End With
Loop
End Sub




Private Sub Command2_Click()
Dim Item As ListItem


For Each Item In ListView1.ListItems
Debug.Print Item.Text, Item.SubItems(1), Item.SubItems(2), Item.SubItems(3)
Next Item

End Sub

Private Sub Form_Load()
Me.Show
Me.ListView1.View = lvwReport

Dim colX As ColumnHeader ' Declare variable.

For intX = 1 To 5
Set colX = ListView1.ColumnHeaders.Add()
colX.Text = "Field " & intX
colX.Width = ListView1.Width / 5
Next intX
With Me.Combo1
.AddItem "Icon" '0
.AddItem "Small Icon" '1
.AddItem "List" '2
.AddItem "Report" '3
.ListIndex = 3
End With


End Sub



Private Sub ListView1_Click()
Data1.Caption = Me.ListView1.SelectedItem.Index & "/" & Totel
End Sub
faysky2 2006-02-14
  • 打赏
  • 举报
回复
显示数据库的数据,可以这样做:

'引用ADO(工程/引用/Microsoft ActiveX Data Object 2.X Library)
'添加MSHFlexGrid控件(工程/部件/Microsoft Hierarchical FlexGrid Control 6.0 (OLEDB))

Private Sub Command1_Click()
Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Test.mdb;User Id=admin;Password=;"
rs.Open "select * from 表 ", cn, adOpenDynamic, adLockOptimistic
Set MSHFlexGrid1.DataSource = rs
End Sub
faysky2 2006-02-14
  • 打赏
  • 举报
回复
FileListBox一般是用来显示文件的,显示数据库的用MSHFlexGrid吧

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧