/ Published in: VB.NET
xphm
Expand |
Embed | Plain Text
Private Sub loadhostel() Dim AllRow As DataRow DAhostellist.Fill(Dsstudents1) For i As Integer = 0 To Dsstudents1.STUDENT.Rows.Count - 1 Step 1 AllRow = Dsstudents1.STUDENT.Rows(i) If ComboBox1.SelectedItem.ToString = ValidateData(AllRow("hostelName")) And ComboBox2.SelectedItem.ToString = ValidateData(AllRow("hostelBlock")) Then AddNewLVRow(ListView1, AllRow) End If Next End Sub Private Sub AddNewLVRow(ByVal ListViewItm As ListView, ByVal xdataRow As DataRow) Dim itmparent As New ListViewItem(ValidateData(xdataRow("studentID"))) Dim itm1 As New ListViewItem.ListViewSubItem(itmparent, ValidateData(xdataRow("hostelNo"))) Dim itm2 As New ListViewItem.ListViewSubItem(itmparent, ValidateData(xdataRow("studentName"))) itmparent.SubItems.Add(itm1) itmparent.SubItems.Add(itm2) ListViewItm.Items.Add(itmparent) End Sub Private Function ValidateData(ByVal value As Object) As String If Not DBNull.Value.Equals(value) Then Return CStr(value) Else Return "-" End If End Function
You need to login to post a comment.
