How to make vb program where he will import invoice template from excel file and fill it out,then to have an print command(button).
Please write,
Thank you.
Howto :Invoice
Started by Nikolasr, Jan 31 2010 09:39 AM
1 reply to this topic
#1
Posted 31 January 2010 - 09:39 AM
|
|
|
#2
Posted 01 February 2010 - 11:21 PM
Hi there you can import the excel data to a datagridview on the vb.net form this way if it is excel 2007, if it is excel 2003 please tell me so i will post you another code:
Dim connectionStringTemplate As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=Yes;IMEX=1"""
Dim connectionString As String = String.Format(connectionStringTemplate, sFileName)
Dim sqlSelect As String = "SELECT * FROM [Sheet1$];"
' Load the Excel worksheet into a DataTable
Dim workbook As DataSet = New DataSet()
Dim excelAdapter As System.Data.Common.DataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlSelect, connectionString)
Try
excelAdapter.Fill(workbook)
Dim worksheet As DataTable = workbook.Tables(0)
dgv.DataSource = worksheet
Catch
'MANAGE EXCEPTION
End Try
Share your Knowledge, It's one way to achieve immortality.
Video Tutorial Channel
Video Tutorial Channel


Sign In
Create Account

Back to top









