Imports System.Windows.Forms Imports MySql.Data.MySqlClient Imports Microsoft.Reporting Imports Microsoft.Reporting.WinForms Public Class printperprecint Dim connectionString As New MySqlConnection("server=10.10.0.6;user id=corpadmin;password=admincorp2024;database=caragavotersdb;port=3706") Private Sub printperprecint_Load(sender As Object, e As EventArgs) Handles MyBase.Load ''TODO: This line of code loads data into the 'caragavotersdbDataSet.bccdetails' table. You can move, or remove it, as needed. 'Me.bccdetailsTableAdapter.Fillbybccdetails(Me.caragavotersdbDataSet.bccdetails) ''TODO: This line of code loads data into the 'caragavotersdbDataSet.pccdetails' table. You can move, or remove it, as needed. 'Me.pccdetailsTableAdapter.Fillpccdetails(Me.caragavotersdbDataSet.pccdetails) ''TODO: This line of code loads data into the 'caragavotersdbDataSet.hlldetails' table. You can move, or remove it, as needed. 'Me.hlldetailsTableAdapter.Fillhhldetails(Me.caragavotersdbDataSet.hlldetails) ''TODO: This line of code loads data into the 'caragavotersdbDataSet.full_data_entry' table. You can move, or remove it, as needed. 'Me.full_data_entryTableAdapter.Fill(Me.caragavotersdbDataSet.full_data_entry) 'Me.ReportViewer1.RefreshReport() selectbargy2() End Sub Private Sub selectbargy2() Dim adapter As New MySqlDataAdapter("SELECT barangay FROM purok ORDER BY barangay ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox1.DataSource = table ComboBox1.ValueMember = "barangay" ComboBox1.DisplayMember = "barangay" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox1.DataSource = lst connectionString.Close() connectionString.Dispose() MySqlConnection.ClearPool(connectionString) End Sub Private Sub selectprec() Dim adapter As New MySqlDataAdapter("SELECT precint FROM hhl WHERE barangay LIKE '%" & ComboBox1.Text & "%' ORDER BY precint ASC", connectionString) Dim table As New DataTable() adapter.Fill(table) ComboBox2.DataSource = table ComboBox2.ValueMember = "precint" ComboBox2.DisplayMember = "precint" Dim lst = (From row In table.AsEnumerable Select row.Field(Of String)(0)).Distinct.ToList ComboBox2.DataSource = lst connectionString.Close() connectionString.Dispose() MySqlConnection.ClearPool(connectionString) End Sub Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged selectprec() End Sub Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged Try Me.full_data_entryTableAdapter.FillByprecintBrgy(Me.caragavotersdbDataSet.full_data_entry, ComboBox2.Text, ComboBox1.Text) Me.hlldetailsTableAdapter.FillByprecintBrgy(Me.caragavotersdbDataSet.hlldetails, ComboBox2.Text, ComboBox1.Text) Me.pccdetailsTableAdapter.FillByprecintBrgy(Me.caragavotersdbDataSet.pccdetails, ComboBox2.Text, ComboBox1.Text) Me.bccdetailsTableAdapter.FillByprecintBrgy(Me.caragavotersdbDataSet.bccdetails, ComboBox2.Text, ComboBox1.Text) Me.ReportViewer1.RefreshReport() Catch ex As Exception End Try End Sub End Class