ListView MultiSelect Show to DataGridView [英] ListView MultiSelect Show to DataGridView
本文介绍了ListView MultiSelect Show to DataGridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
多选Listview数据显示给DATAGRIDVIEW ... PLEAE帮帮我..
我在ListView数据中有数据
Regno名称
A100 AAA
A200 BBB
A300 CCC
我选择A100和A300只有我想要显示给DAtaGirdView
我期待OutPut赞这个
REgno名称
A100 AAA
A300 BBB
我在这里使用代码
Hi All
Multiselect Listview Data Show To DATAGRIDVIEW... PLEAE HELP ME..
I have data in ListView Data
Regno Name
A100 AAA
A200 BBB
A300 CCC
I Selected A100 and A300 that only i want to Show to DAtaGirdView
I Expect OutPut Like This
REgno Name
A100 AAA
A300 BBB
Here I USE CODE
For i As Integer = 0 To ListView1.SelectedItems.Count - 1
Dim strSQL1 As String = "SELECT * FROM Exam_Absent where Stud_Name='" & ListView1.SelectedItems.Item(i).SubItems(1).Text & "'"
Dim DaAp1 As New SqlDataAdapter(strSQL1, con)
Dim Dset1 As New DataTable
DaAp1.Fill(Dset1)
DGV1.DataSource = Dset1
Dset1.AcceptChanges()
Next i
推荐答案
For Each dr As DataRow In Dset1.Rows
Me.DGV1.Rows.Add()
With Me.DGV1.Rows(Me.DGV1.Rows.Count - 1)
.Cells("Regno").Value = dr("Regno")
.Cells("Stud_Name").Value = (dr("Stud_Name"))
End With
Next
这篇关于ListView MultiSelect Show to DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文