Imports MySql.Data.MySqlClient Public Class DeleteBy Public sCon As MySqlConnection = New MySqlConnection Public sComand As MySqlDataAdapter = New MySqlDataAdapter Public ds As DataSet = New DataSet Dim scrollVal As Integer Dim pagingAdapter As MySqlDataAdapter Dim pagingDS As DataSet Dim pagingDS2 As DataSet Private sRecord_Count As Integer Dim conn As MySqlConnection Dim cmd As MySqlCommand Dim dr As MySqlDataReader Dim connectionString As New MySqlConnection("server=10.10.0.6;user id=corpadmin;password=admincorp2024;database=caragavotersdb;port=3706") Private Sub conns() Try conn = New MySqlConnection("server=10.10.0.6;user id=corpadmin;password=admincorp2024;database=caragavotersdb;port=3706") conn.Open() Catch ex As Exception MessageBox.Show("Please Close to finish update 5 seconds & Open the program again. Or contact the programmer", "hhl no connection", MessageBoxButtons.OK, MessageBoxIcon.Error) End End Try End Sub Private Sub DeleteBy_Load(sender As Object, e As EventArgs) Handles MyBase.Load Size = New Drawing.Size(396, 283) MinimumSize = New Drawing.Size(396, 283) MaximumSize = New Drawing.Size(396, 283) End Sub Private Sub delHhlbyPCCofBCCname() Try If ComboBox1.Text = "" Or ComboBox2.Text = "" Or ComboBox3.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else 'If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then For i As Integer = 0 To DataGridView3.Rows.Count - 1 Call conns() cmd = New MySqlCommand("Delete from hhl where pcc = '%" & DataGridView3.Rows(i).Cells(0).Value & "%'", conn) cmd.ExecuteNonQuery() MsgBox("HHL List under PCC List of BCC:'" & ComboBox3.Text & "' Successfully Deleted", MsgBoxStyle.Information, "Deleted") Next 'End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delMemberOfHhlbyPCCname() Try If ComboBox1.Text = "" Or ComboBox2.Text = "" Or ComboBox3.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else 'If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then For i As Integer = 0 To DataGridView2.Rows.Count - 1 Call conns() cmd = New MySqlCommand("Delete from full_data_entry where pco = '%" & DataGridView2.Rows(i).Cells(0).Value & "%'", conn) cmd.ExecuteNonQuery() MsgBox("Member List under HHL List of PCC:'" & ComboBox3.Text & "' Successfully Deleted", MsgBoxStyle.Information, "Deleted") Next 'End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delhhlbyPCCname() Try If ComboBox1.Text = "" Or ComboBox2.Text = "" Or ComboBox3.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else ' If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then Call conns() cmd = New MySqlCommand("Delete from hhl where pcc = '" & ComboBox3.Text & "'", conn) cmd.ExecuteNonQuery() MsgBox("HHL List under PCC:'" & ComboBox3.Text & "' Successfully Deleted", MsgBoxStyle.Information, "PCC Deleted") delMemberOfHhlbyPCCname() ' End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delPCCbyname() Try If ComboBox1.Text = "" Or ComboBox2.Text = "" Or ComboBox3.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then Call conns() cmd = New MySqlCommand("Delete from pco where names = '" & ComboBox3.Text & "'", conn) cmd.ExecuteNonQuery() MsgBox("'" & ComboBox3.Text & "' Successfully Deleted from PCC ", MsgBoxStyle.Information, "PCC Deleted") delhhlbyPCCname() End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub selectPCCbyNAME() Try Dim adapter As New MySqlDataAdapter("SELECT names FROM pco ORDER BY names ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox3.DataSource = table ComboBox3.ValueMember = "names" ComboBox3.DisplayMember = "names" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox3.DataSource = lst Catch ex As Exception MsgBox(ex.Message) Finally connectionString.Close() connectionString.Dispose() End Try End Sub Private Sub selectBCCbyNAME() Try Dim adapter As New MySqlDataAdapter("SELECT names FROM bcc ORDER BY names ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox3.DataSource = table ComboBox3.ValueMember = "names" ComboBox3.DisplayMember = "names" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox3.DataSource = lst Catch ex As Exception MsgBox(ex.Message) Finally connectionString.Close() connectionString.Dispose() End Try End Sub Private Sub selectPCCbyBrgy() Try Dim adapter As New MySqlDataAdapter("SELECT barangay FROM pco ORDER BY barangay ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox3.DataSource = table ComboBox3.ValueMember = "barangay" ComboBox3.DisplayMember = "barangay" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox3.DataSource = lst Catch ex As Exception MsgBox(ex.Message) Finally connectionString.Close() connectionString.Dispose() End Try End Sub Private Sub selectPCCbyBrgypurok() Try Dim adapter As New MySqlDataAdapter("SELECT purok FROM pco WHERE barangay LIKE '%" & ComboBox3.Text & "%' ORDER BY purok ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox4.DataSource = table ComboBox4.ValueMember = "purok" ComboBox4.DisplayMember = "purok" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox4.DataSource = lst Catch ex As Exception MsgBox(ex.Message) Finally connectionString.Close() connectionString.Dispose() End Try End Sub Private Sub delhhlmemberbyname() Try Call conns() cmd = New MySqlCommand("Delete from full_data_entry where pco = '" & ComboBox3.Text & "'", conn) cmd.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delhhlmemberbybrgy() Try Call conns() cmd = New MySqlCommand("Delete from full_data_entry where barangay = '" & ComboBox3.Text & "'", conn) cmd.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delhhlmemberbybrgypurok() Try Call conns() cmd = New MySqlCommand("Delete from full_data_entry where barangay = '" & ComboBox3.Text & "' and address = '" & ComboBox4.Text & "'", conn) cmd.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delhhlmemberbyall() Try Call conns() cmd = New MySqlCommand("Delete * from full_data_entry", conn) cmd.ExecuteNonQuery() Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub selecthhlbyNAME() Try Dim adapter As New MySqlDataAdapter("SELECT names FROM hhl ORDER BY names ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox3.DataSource = table ComboBox3.ValueMember = "names" ComboBox3.DisplayMember = "names" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox3.DataSource = lst Catch ex As Exception MsgBox(ex.Message) Finally connectionString.Close() connectionString.Dispose() End Try End Sub Private Sub selecthhlbyBrgy() Try Dim adapter As New MySqlDataAdapter("SELECT barangay FROM hhl ORDER BY barangay ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox3.DataSource = table ComboBox3.ValueMember = "barangay" ComboBox3.DisplayMember = "barangay" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox3.DataSource = lst Catch ex As Exception MsgBox(ex.Message) Finally connectionString.Close() connectionString.Dispose() End Try End Sub Private Sub selecthhlbyBrgypurok() Try Dim adapter As New MySqlDataAdapter("SELECT purok FROM hhl WHERE barangay LIKE '%" & ComboBox3.Text & "%' ORDER BY purok ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox4.DataSource = table ComboBox4.ValueMember = "purok" ComboBox4.DisplayMember = "purok" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox4.DataSource = lst Catch ex As Exception MsgBox(ex.Message) Finally connectionString.Close() connectionString.Dispose() End Try End Sub Private Sub delhhlbyBrgy() Try If ComboBox1.Text = "" Or ComboBox2.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then Call conns() cmd = New MySqlCommand("Delete from hhl where barangay = '" & ComboBox3.Text & "'", conn) cmd.ExecuteNonQuery() MsgBox("Successfully Deleted", MsgBoxStyle.Information, "Deleted") delhhlmemberbybrgy() End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delhhlbyBrgypurok() Try If ComboBox1.Text = "" Or ComboBox2.Text = "" Or ComboBox3.Text = "" Or ComboBox4.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then Call conns() cmd = New MySqlCommand("Delete from hhl where barangay = '" & ComboBox3.Text & "' and purok = '" & ComboBox4.Text & "'", conn) cmd.ExecuteNonQuery() MsgBox("Successfully Deleted", MsgBoxStyle.Information, "Deleted") delhhlmemberbybrgypurok() End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delhhlbyall() Try If ComboBox1.Text = "" Or ComboBox2.Text = "" Or ComboBox3.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then Call conns() cmd = New MySqlCommand("Delete * from hhl", conn) cmd.ExecuteNonQuery() MsgBox("Successfully Deleted", MsgBoxStyle.Information, "Deleted") delhhlmemberbyall() End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub delhhlbyname() Try If ComboBox1.Text = "" Or ComboBox2.Text = "" Or ComboBox3.Text = "" Then MessageBox.Show("Please Check Input", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error) Else If MsgBox("Are you sure do you want to delete?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.DefaultButton1 + MsgBoxStyle.Exclamation, MsgBoxStyle), "Delete") = MsgBoxResult.Yes Then Call conns() cmd = New MySqlCommand("Delete from hhl where names = '" & ComboBox3.Text & "'", conn) cmd.ExecuteNonQuery() MsgBox("Successfully Deleted", MsgBoxStyle.Information, "Deleted") delhhlmemberbyname() End If End If Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click '===========================HHL========================== If ComboBox1.Text = "HHL" And ComboBox2.Text = "NAME" Then If Dashboard.Label17.Text = "lhoy" Or Dashboard.Label17.Text = "EL" Then sqlbackuperclik() Else End If delhhlbyname() 'ElseIf ComboBox1.Text = "HHL" And ComboBox2.Text = "BARANGAY" Then ' 'sqlbackuperclik() ' delhhlbyBrgy() 'ElseIf ComboBox1.Text = "HHL" And ComboBox2.Text = "PUROK" Then ' 'sqlbackuperclik() ' delhhlbyBrgypurok() 'ElseIf ComboBox1.Text = "HHL" And ComboBox2.Text = "ALL" Then ' 'sqlbackuperclik() ' delhhlbyall() '===========================PCC========================== 'ElseIf ComboBox1.Text = "PCC" And ComboBox2.Text = "BARANGAY" Then ' 'sqlbackuperclik() ' delhhlbyBrgy() 'ElseIf ComboBox1.Text = "PCC" And ComboBox2.Text = "PUROK" Then ' 'sqlbackuperclik() ' delhhlbyBrgypurok() 'ElseIf ComboBox1.Text = "PCC" And ComboBox2.Text = "ALL" Then ' 'sqlbackuperclik() ' delhhlbyall() ElseIf ComboBox1.Text = "PCC" And ComboBox2.Text = "NAME" Then If Dashboard.Label17.Text = "lhoy" Or Dashboard.Label17.Text = "EL" Then sqlbackuperclik() Else End If delPCCbyname() ElseIf ComboBox1.Text = "BCC" And ComboBox2.Text = "NAME" Then If Dashboard.Label17.Text = "lhoy" Or Dashboard.Label17.Text = "EL" Then sqlbackuperclik() Else End If delPCCbyname() End If End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged End Sub Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged If ComboBox1.Text = "HHL" And ComboBox2.Text = "BARANGAY" Then selecthhlbyBrgy() ComboBox4.Visible = False ElseIf ComboBox1.Text = "HHL" And ComboBox2.Text = "PUROK" Then selecthhlbyBrgy() ComboBox4.Visible = True ElseIf ComboBox1.Text = "HHL" And ComboBox2.Text = "ALL" Then ComboBox3.DataSource = Nothing ComboBox3.Text = "ALL HHL WILL BE DELETED" ComboBox4.Visible = False ElseIf ComboBox1.Text = "HHL" And ComboBox2.Text = "NAME" Then selecthhlbyNAME() ComboBox4.Visible = False ElseIf ComboBox1.Text = "PCC" And ComboBox2.Text = "NAME" Then selectPCCbyNAME() ComboBox4.Visible = False ElseIf ComboBox1.Text = "BCC" And ComboBox2.Text = "NAME" Then selectBCCbyNAME() ComboBox4.Visible = False End If End Sub Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox3.SelectedIndexChanged If ComboBox1.Text = "HHL" And ComboBox2.Text = "PUROK" Then selecthhlbyBrgypurok() ElseIf ComboBox1.Text = "PCC" And ComboBox2.Text = "PUROK" Then selectPCCbyBrgypurok() ElseIf ComboBox1.Text = "HHL" And ComboBox2.Text = "NAME" Then fillisthhlmember() Size = New Drawing.Size(430, 682) MinimumSize = New Drawing.Size(430, 682) MaximumSize = New Drawing.Size(430, 682) ElseIf ComboBox1.Text = "PCC" And ComboBox2.Text = "NAME" Then fillistpccmember() fillistMemberofHHLmember() Size = New Drawing.Size(843, 682) MinimumSize = New Drawing.Size(843, 682) MaximumSize = New Drawing.Size(843, 682) ElseIf ComboBox1.Text = "BCC" And ComboBox2.Text = "NAME" Then fillistBccmember() fillistHHLofPCCmember() fillistMemberofHHLmember() Size = New Drawing.Size(1254, 682) MinimumSize = New Drawing.Size(1254, 682) MaximumSize = New Drawing.Size(1254, 682) End If End Sub Private Sub ComboBox4_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox4.SelectedIndexChanged End Sub Private Sub fillisthhlmember() Try conns() cmd = New MySqlCommand("SELECT * FROM full_data_entry where pco LIKE '%" & ComboBox3.Text & "%' ORDER BY name ASC", conn) cmd.ExecuteNonQuery() conn.Close() pagingAdapter = New MySqlDataAdapter(cmd) pagingDS = New DataSet() pagingDS2 = New DataSet() conn.Open() pagingAdapter.Fill(pagingDS2, "full_data_entry_table") pagingAdapter.Fill(pagingDS, scrollVal, 20, "full_data_entry_table") conn.Close() DataGridView1.DataSource = pagingDS DataGridView1.DataMember = "full_data_entry_table" With DataGridView1 '.Columns(0).HeaderCell.Value = "ID No." .Columns(2).HeaderCell.Value = "Name" .Columns(3).HeaderCell.Value = "Purok" .Columns(5).HeaderCell.Value = "Gender" .Columns(6).HeaderCell.Value = "Precinct number" .Columns(7).HeaderCell.Value = "Barangay" '.Columns(8).HeaderCell.Value = "Province" '.Columns(9).HeaderCell.Value = "Municipality" .Columns(10).HeaderCell.Value = "VoteForMJ?" .Columns(11).HeaderCell.Value = "HHL" End With DataGridView1.Columns.Item("id").Visible = False DataGridView1.Columns.Item("name").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns.Item("address").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns.Item("Gender").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns.Item("precinct_number").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns.Item("barangay").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns.Item("municipality").Visible = False DataGridView1.Columns.Item("province").Visible = False DataGridView1.Columns.Item("number").Visible = False DataGridView1.Columns.Item("birthday").Visible = False DataGridView1.Columns.Item("statusv").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns.Item("pco").AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.DefaultCellStyle.Font = New Font("arial", 12) 'DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill 'DataGridView1.Dock = DockStyle.Fill Dashboard.counters() Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub fillistpccmember() Dim table As New DataTable() Try conns() Dim adapter As New MySqlDataAdapter("SELECT names,pcc,barangay,purok FROM hhl where pcc LIKE '%" & ComboBox3.Text & "%' ORDER BY names ASC", conn) adapter.Fill(table) DataGridView2.DataSource = table With DataGridView2 .Columns(0).HeaderCell.Value = "Name" .Columns(1).HeaderCell.Value = "PCC" .Columns(2).HeaderCell.Value = "Barangay" .Columns(3).HeaderCell.Value = "Purok" End With DataGridView2.Columns(0).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView2.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView2.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView2.Columns(3).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView2.DefaultCellStyle.Font = New Font("arial", 12) Catch ex As Exception 'MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub Private Sub fillistMemberofHHLmember() Dim table As New DataTable() Try For i As Integer = 0 To DataGridView2.Rows.Count - 1 conns() Dim adapter As New MySqlDataAdapter("SELECT name,pco,barangay,address FROM full_data_entry where pco LIKE '%" & DataGridView2.Rows(i).Cells(0).Value & "%' ORDER BY name ASC", conn) adapter.Fill(table) Next DataGridView1.DataSource = table With DataGridView1 .Columns(0).HeaderCell.Value = "Name" .Columns(1).HeaderCell.Value = "HHL" .Columns(2).HeaderCell.Value = "Barangay" .Columns(3).HeaderCell.Value = "Purok" End With DataGridView1.Columns(0).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.Columns(3).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView1.DefaultCellStyle.Font = New Font("arial", 12) Catch ex As Exception 'MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try Dashboard.counters() End Sub Private Sub fillistHHLofPCCmember() Dim table As New DataTable() Try For i As Integer = 0 To DataGridView3.Rows.Count - 1 conns() Dim adapter As New MySqlDataAdapter("SELECT names,pcc,barangay,purok FROM hhl where pcc LIKE '%" & DataGridView3.Rows(i).Cells(0).Value & "%' ORDER BY names ASC", conn) adapter.Fill(table) Next DataGridView2.DataSource = table With DataGridView2 .Columns(0).HeaderCell.Value = "Name" .Columns(1).HeaderCell.Value = "PCC" .Columns(2).HeaderCell.Value = "Barangay" .Columns(3).HeaderCell.Value = "Purok" End With DataGridView2.Columns(0).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView2.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView2.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView2.Columns(3).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView2.DefaultCellStyle.Font = New Font("arial", 12) Catch ex As Exception 'MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try ' Dashboard.counters() End Sub Private Sub fillistBccmember() Dim table As New DataTable() Try conns() Dim adapter As New MySqlDataAdapter("SELECT names,bcc,barangay,purok FROM pco where bcc LIKE '%" & ComboBox3.Text & "%' ORDER BY names ASC", conn) adapter.Fill(table) DataGridView3.DataSource = table With DataGridView3 .Columns(0).HeaderCell.Value = "Name" .Columns(1).HeaderCell.Value = "BCC" .Columns(2).HeaderCell.Value = "Barangay" .Columns(3).HeaderCell.Value = "Purok" End With DataGridView3.Columns(0).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView3.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView3.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView3.Columns(3).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells DataGridView3.DefaultCellStyle.Font = New Font("arial", 12) Catch ex As Exception 'MsgBox(ex.Message) Finally conn.Close() conn.Dispose() End Try End Sub End Class