Jump to content

Howto :Invoice

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
Nikolasr

Nikolasr

    Newbie

  • Members
  • Pip
  • 2 posts
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.

#2
Ray Tawil

Ray Tawil

    Programmer

  • Members
  • PipPipPipPip
  • 108 posts
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