0

hi every one after connecting to an excel file I want to import the firts row into a combobox
in the connection function I added thhis
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from[sheet1$]", MyConnection)
MyCommand.TableMappings.Add("Table", "Attendence")

DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ComboBox1.datasource= DtSet.Tables(0) i think this is error

and when I run my combo box will get filled with nSystem.Data.DataRowView

by the way I want only th first row to get imported in my cobo box how is the sql query

thanks in advance

4
Contributors
7
Replies
9
Views
9 Years
Discussion Span
Last Post by Hamrick
0

hi
this link is empty and also I searched I could not find the information I wanted please send me the exact link if you know . I would like to know how can I import the data column I want in my excel sheet , in the combo box .
thanks again

0

and when I run my combo box will get filled with nSystem.Data.DataRowView

You set the data source but not the display member. The display member is the name of the column in the data table that you want to show in the list.

ComboBox1.DataSource = dt.Tables( 0 )
ComboBox1.DisplayMember = "Name"
0

apchidara, please can you let me have a fully working link - I am working on an application that needs to do a lot of work with Excel.

0

apchidara, please can you let me have a fully working link - I am working on an application that needs to do a lot of work with Excel.

hi :
which code you need the excel connection code?

0

hey hamrik
I did it for one comboBox it works and the second I wanted it to be filled with the other column and I put the name of that culumn but u know what ? the combo box will get filled with the previous column that means both ae the same here is the code:

Dim ComboBox2 As ComboBox
ComboBox1.DataSource = DtSet.Tables(0)
ComboBox1.DisplayMember = "Iso Standards"
ComboBox2.DataSource = DtSet.Tables(0)
ComboBox2.DisplayMember = "MVB Standard"

0

There's no reason that should happen unless you did something else later in the code that changes the bindings.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.