VB.NET ListView绑定数据库问题
ListView1.FullRowSelect=TrueListView1.View=View.DetailsListView1.Scrollable=TrueListV...
ListView1.FullRowSelect = True
ListView1.View = View.Details
ListView1.Scrollable = True
ListView1.MultiSelect = False
ListView1.HeaderStyle = ColumnHeaderStyle.Clickable
'标头
ListView1.Columns.Add("ID", 120, HorizontalAlignment.Center)
ListView1.Columns.Add("项目", 250, HorizontalAlignment.Center)
ListView1.Columns.Add("单位", 92, HorizontalAlignment.Center)
Dim sda As OleDbDataAdapter = New OleDbDataAdapter("select * from 表 where len(id)=4", con)
Dim dt As New DataTable
sda.Fill(dt)
For i = 0 To dt.Columns.ToString - 1
Dim itme As ListViewItem = ListView1.Items.Add(dt.Rows(i)(0).ToString)
itme.SubItems.AddRange({dt.Rows(i)(1).ToString, dt.Rows(i)(2).ToString})
Next
制作ListView绑定数据库,数据无法显示,请教大神指点。 展开
ListView1.View = View.Details
ListView1.Scrollable = True
ListView1.MultiSelect = False
ListView1.HeaderStyle = ColumnHeaderStyle.Clickable
'标头
ListView1.Columns.Add("ID", 120, HorizontalAlignment.Center)
ListView1.Columns.Add("项目", 250, HorizontalAlignment.Center)
ListView1.Columns.Add("单位", 92, HorizontalAlignment.Center)
Dim sda As OleDbDataAdapter = New OleDbDataAdapter("select * from 表 where len(id)=4", con)
Dim dt As New DataTable
sda.Fill(dt)
For i = 0 To dt.Columns.ToString - 1
Dim itme As ListViewItem = ListView1.Items.Add(dt.Rows(i)(0).ToString)
itme.SubItems.AddRange({dt.Rows(i)(1).ToString, dt.Rows(i)(2).ToString})
Next
制作ListView绑定数据库,数据无法显示,请教大神指点。 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏20(财富值+成长值)
2个回答
展开全部
直接把ListView1的册滑配SubItems好像没有让困明确的参数,你选指定一下要插入SubItems的items,
可以试州指试用listView1.Items[i].SubItems[1].Text
可以试州指试用listView1.Items[i].SubItems[1].Text
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询