Private Sub btncheck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncheck.Click Dim mytable As New DataTable CMD.Connection = CN CMD.CommandText = "Select classname,studentname,fname,grno from students where classname='" & Me.ComboBox2.Text & "'" DataR = CMD.ExecuteReader Dim i As Integer For i = 0 To mytable.Rows.Count - 1 DataR.Read() Next mytable.Load(DataR) DGV2.DataSource = mytable DGV2.Columns.Add("feemonth", "Fee Month") DGV2.Columns.Add("status", "Status") For i = 0 To mytable.Rows.Count - 1 Dim i2 As Integer For i2 = 0 To DGV2.Rows.Count - 1 Next With DGV2 .Columns("classname").HeaderCell.Value = ("Class") .Columns("studentname").HeaderCell.Value = ("Student Name") .Columns("fname").HeaderCell.Value = ("Father's Name") .Columns("grno").HeaderCell.Value = ("GR NO") End With If DGV1.Rows.Count > 0 Then End If If DGV1.Rows.Count = 0 Then DGV2.Rows(i).Cells("status").Value = "Un Paid" DGV2.Rows(i).Cells("feemonth").Value = Me.ComboBox1.Text DGV2.Rows(i).Cells("status").Style.ForeColor = Color.Red ElseIf DGV1.CurrentRow.Cells("name").Value.ToString = DGV2.Rows(i).Cells("studentname").Value.ToString Then DGV2.Rows(i).Cells("status").Value = "Paid" DGV2.Rows(i).Cells("status").Style.ForeColor = Color.Blue DGV2.Rows(i).Cells("feemonth").Value = Me.ComboBox1.Text Else DGV2.Rows(i).Cells("status").Value = "UN Paid" DGV2.Rows(i).Cells("status").Style.ForeColor = Color.Red DGV2.Rows(i).Cells("feemonth").Value = Me.ComboBox1.Text End If Next DataR.Close() End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)