Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim dataSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim path As String = "C:\\Users\\dwishika\\Desktop\\vids\\excel\\Book1.xlsx"
MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection)
dataSet = New System.Data.DataSet
MyCommand.Fill(dataSet)
DataGridView1.DataSource = dataSet.Tables(0)
MyConnection.Close()
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End Sub
End Class
---------------------------------------
Importing Any Excel Spreadsheet into a DataGridView - C#
VB.NET - Importing Excel File to dataGridView
import Excel File to VB.NET.net DataGridView
Import Excel To DatagridView
Import Data from Excel to DataGridView in VB.NET
import from excel to datagridview
VB.NET DataGridView Loading data from Excel
importing excel file into datagridview How to get data from excel sheet to datagridview in VB.NET importing RowName and ColumnName from an excelfile posts
Import Excel file to DataGridView VB.NET
Saving DataGrid View to Excel and opening Excel to
How to import data from Excel to Datagrid
How to Export Datagridview contents to Excel - VB.NET
0 comments:
Post a Comment