Using VS2017 I have created a windows form containing a datagridview populated from an Excel workbook.
The population is performed using the following code.
This works fine.Code:Imports System.IO Imports ExcelDataReader Public Class Products Dim FilePath As String Dim tables As DataTableCollection Dim result As New DataSet Dim dt As DataTable Private Sub Products_Load(sender As Object, e As EventArgs) Handles MyBase.Load Using ofd As OpenFileDialog = New OpenFileDialog() ofd.FileName = "E:\MWP\Databases\NoDupeLinkDB.xlsx" tbFile.Text = ofd.FileName Using stream = File.Open(ofd.FileName, FileMode.Open, FileAccess.Read) Using reader As IExcelDataReader = ExcelReaderFactory.CreateReader(stream) result = reader.AsDataSet(New ExcelDataSetConfiguration() With { .ConfigureDataTable = Function(__) New ExcelDataTableConfiguration() With { .UseHeaderRow = True}}) tables = result.Tables cboSheet.Items.Clear() For Each table As DataTable In tables cboSheet.Items.Add(table.TableName) Next End Using End Using End Using cboSheet.Text = "Tabs" dt = tables(cboSheet.SelectedItem.ToString()) dgvProdND.DataSource = dt End Sub
What I am looking to do is to type something into a textbox and have a second datagrid populated with matching records from the first.
So I would have dgvProdND populated as above; type something like "Abil" into the textbox and have a second datagrid (dgvResult) populated with rows from dgvProdND where the "Description" column matches, or is like the typed text.
Research on this appears to always refer to querying the source database (usually MS Access); but I don't have a connection to an Access database.
I'm fairly new to vb so please be gentle!!!




Reply With Quote
