Click here to Skip to main content
15,902,447 members
Home / Discussions / Visual Basic
   

Visual Basic

 
NewsWorkaround: DrawItem for flagged listbox item? Pin
Sonhospa12-Jul-09 2:34
Sonhospa12-Jul-09 2:34 
AnswerRe: DrawItem for flagged listbox item? Pin
Henry Minute12-Jul-09 3:46
Henry Minute12-Jul-09 3:46 
GeneralRe: DrawItem for flagged listbox item? Pin
Sonhospa12-Jul-09 7:25
Sonhospa12-Jul-09 7:25 
QuestionRead selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk11-Jul-09 21:58
drexler_kk11-Jul-09 21:58 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
dan!sh 11-Jul-09 22:34
professional dan!sh 11-Jul-09 22:34 
QuestionRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk11-Jul-09 22:51
drexler_kk11-Jul-09 22:51 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
dan!sh 11-Jul-09 23:47
professional dan!sh 11-Jul-09 23:47 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
helelark12311-Jul-09 23:52
helelark12311-Jul-09 23:52 
I tried it for you and it works well:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyConn As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter

Try
MyConn = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; Data Source='c:\1.xls'; Extended Properties=Excel 8.0;")
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select Qty from [Sheet1$] ", MyConn)
MyCommand.TableMappings.Add("Table", "TestTable")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
DataGridView1.DataSource = DtSet.Tables(0)
MyConn.Close()

Catch ex As Exception

End Try
End Sub


----------------------------------------------------------------------
For example
Excel FullFileName: C:\1.xls
In sheet1 add 3 columns (from A1 to A3):
A1=Qty A2=100 A3=250
B1=Prod B2=A B3=B
C1=ID C2=1 C2=2


I suggest you to do this simple example that works fine and after you get that this example works with no problem try to check where is your problem

Shay Noy

QuestionRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk12-Jul-09 0:17
drexler_kk12-Jul-09 0:17 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
Paramu197312-Jul-09 0:29
Paramu197312-Jul-09 0:29 
QuestionRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk12-Jul-09 0:38
drexler_kk12-Jul-09 0:38 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 [modified] Pin
helelark12312-Jul-09 0:49
helelark12312-Jul-09 0:49 
QuestionRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk12-Jul-09 0:54
drexler_kk12-Jul-09 0:54 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
helelark12312-Jul-09 0:56
helelark12312-Jul-09 0:56 
QuestionRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk12-Jul-09 1:21
drexler_kk12-Jul-09 1:21 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
helelark12312-Jul-09 1:24
helelark12312-Jul-09 1:24 
QuestionRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk12-Jul-09 1:42
drexler_kk12-Jul-09 1:42 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
helelark12312-Jul-09 1:45
helelark12312-Jul-09 1:45 
GeneralRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk12-Jul-09 2:00
drexler_kk12-Jul-09 2:00 
GeneralRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
helelark12312-Jul-09 2:10
helelark12312-Jul-09 2:10 
QuestionRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk12-Jul-09 2:15
drexler_kk12-Jul-09 2:15 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
helelark12312-Jul-09 2:17
helelark12312-Jul-09 2:17 
AnswerRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
drexler_kk12-Jul-09 2:25
drexler_kk12-Jul-09 2:25 
GeneralRe: Read selected Excel data into DataGridView using VB.NET2008 Pin
helelark12312-Jul-09 2:28
helelark12312-Jul-09 2:28 
QuestionNetwork Messages? Pin
Paramu197311-Jul-09 21:34
Paramu197311-Jul-09 21:34 

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.