Click here to Skip to main content
15,886,689 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to commnuicated between VBS and C# Pin
Member 145249559-Jul-19 15:20
Member 145249559-Jul-19 15:20 
GeneralRe: How to commnuicated between VBS and C# Pin
Dave Kreskowiak10-Jul-19 5:04
mveDave Kreskowiak10-Jul-19 5:04 
Questionhow to deal with this error Pin
Member 145002187-Jul-19 22:09
Member 145002187-Jul-19 22:09 
NewsRe: how to deal with this error Pin
CHill608-Jul-19 1:45
mveCHill608-Jul-19 1:45 
AnswerRe: how to deal with this error Pin
Dave Kreskowiak8-Jul-19 2:11
mveDave Kreskowiak8-Jul-19 2:11 
Questionemail a attached file vb.net Pin
Member 145002187-Jul-19 21:00
Member 145002187-Jul-19 21:00 
AnswerRe: email a attached file vb.net Pin
Chris Quinn8-Jul-19 0:58
Chris Quinn8-Jul-19 0:58 
GeneralRe: email a attached file vb.net Pin
Member 145002188-Jul-19 23:15
Member 145002188-Jul-19 23:15 
Dear Friends at code project,

The code i use is as follows

Private Sub BtnExcel_Click(sender As Object, e As EventArgs) Handles btnExcel.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\Abhimanyu Singh\Documents\excel\SalarySlip.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 [salaryslip$]", 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


It works well for a single Excel file but if i try to open another fileit gives me error

"OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET"
IAM NOT ABLE TO MOVE AHEAD PLEASE SUGEST REMIDIES
AnswerRe: email a attached file vb.net Pin
Dave Kreskowiak8-Jul-19 2:12
mveDave Kreskowiak8-Jul-19 2:12 
QuestionUsing a custom renderer for toolstrip, but only first button is properly painted Pin
Alan Burkhart5-Jul-19 5:53
Alan Burkhart5-Jul-19 5:53 
QuestionMDI Child form background transparent Pin
smdoss2-Jul-19 4:01
smdoss2-Jul-19 4:01 
SuggestionRe: MDI Child form background transparent Pin
Maciej Los2-Jul-19 5:37
mveMaciej Los2-Jul-19 5:37 
RantRe: MDI Child form background transparent Pin
Richard Deeming2-Jul-19 5:38
mveRichard Deeming2-Jul-19 5:38 
QuestionInput string was not in a correct format. error message Pin
IC0D330-Jun-19 7:47
IC0D330-Jun-19 7:47 
AnswerRe: Input string was not in a correct format. error message Pin
Dave Kreskowiak30-Jun-19 8:03
mveDave Kreskowiak30-Jun-19 8:03 
AnswerRe: Input string was not in a correct format. error message Pin
Maciej Los30-Jun-19 9:54
mveMaciej Los30-Jun-19 9:54 
QuestionUsing static library in Visual Basic Pin
Member 1451037923-Jun-19 23:05
Member 1451037923-Jun-19 23:05 
AnswerRe: Using static library in Visual Basic Pin
Dave Kreskowiak24-Jun-19 12:18
mveDave Kreskowiak24-Jun-19 12:18 
Questionretrieval of XML information & Copy to excel Files Pin Pin
Member 1450608920-Jun-19 13:29
Member 1450608920-Jun-19 13:29 
AnswerRe: retrieval of XML information & Copy to excel Files Pin Pin
Richard Deeming21-Jun-19 1:07
mveRichard Deeming21-Jun-19 1:07 
QuestionProblem cropping an image. SOLVED Pin
mo14928-Jun-19 6:07
mo14928-Jun-19 6:07 
AnswerRe: Problem cropping an image. more info Pin
mo14928-Jun-19 9:46
mo14928-Jun-19 9:46 
GeneralRe: Problem cropping an image. more info Pin
Dave Kreskowiak8-Jun-19 16:29
mveDave Kreskowiak8-Jun-19 16:29 
GeneralRe: Problem cropping an image. more info Pin
mo14928-Jun-19 23:34
mo14928-Jun-19 23:34 
AnswerRe: Problem cropping an image. Pin
Gerry Schmitz8-Jun-19 12:05
mveGerry Schmitz8-Jun-19 12:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.