Click here to Skip to main content
14,236,167 members

Visual Basic

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 22:40
adminChris Maunder12-Jul-09 22:40 
PinnedHow to get an answer to your question PinPopular
Chris Maunder10-Nov-05 16:30
adminChris Maunder10-Nov-05 16:30 
QuestionProblem with treeview drag and drop Pin
speedbump9912-Jul-19 9:02
memberspeedbump9912-Jul-19 9:02 
QuestionHow to commnuicated between VBS and C# Pin
Member 145249558-Jul-19 21:48
memberMember 145249558-Jul-19 21:48 
GeneralRe: How to commnuicated between VBS and C# Pin
Ralf Meier8-Jul-19 23:56
professionalRalf Meier8-Jul-19 23:56 
AnswerRe: How to commnuicated between VBS and C# Pin
Dave Kreskowiak9-Jul-19 6:19
mveDave Kreskowiak9-Jul-19 6:19 
GeneralRe: How to commnuicated between VBS and C# Pin
Member 145249559-Jul-19 15:20
memberMember 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
memberMember 145002187-Jul-19 22:09 
NewsRe: how to deal with this error Pin
CHill608-Jul-19 1:45
protectorCHill608-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
memberMember 145002187-Jul-19 21:00 
AnswerRe: email a attached file vb.net Pin
Chris Quinn8-Jul-19 0:58
memberChris Quinn8-Jul-19 0:58 
GeneralRe: email a attached file vb.net Pin
Member 145002188-Jul-19 23:15
memberMember 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
memberAlan Burkhart5-Jul-19 5:53 
SuggestionMessage Closed Pin
2-Jul-19 17:17
memberMember 145191992-Jul-19 17:17 
QuestionMDI Child form background transparent Pin
smdoss2-Jul-19 4:01
membersmdoss2-Jul-19 4:01 
SuggestionRe: MDI Child form background transparent Pin
Maciej Los2-Jul-19 5:37
protectorMaciej 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
memberIC0D330-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
protectorMaciej Los30-Jun-19 9:54 
QuestionUsing static library in Visual Basic Pin
Member 1451037923-Jun-19 23:05
memberMember 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 

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.