Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6881077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:03:41+00:00 2026-05-27T05:03:41+00:00

I have an excel file which has two columns (1. Name and 2. Value)

  • 0

I have an excel file which has two columns (1. Name and 2. Value) which I want to bind to a ComboBox.

When I set the DisplayMember to name it shows the all the values from the Name column in the Excel file.

I would like to get a similar dropdown as in asp.net controls with a text field and a value field so that when I select the text field then value field can be obtained using background code.

How can I do in ComboBox(WinForms)?

i am using following code.

String strConn = "Provider=Microsoft.jet.OLEDB.4.0;" + "Data Source="C:\vipin.xls"+ "Extended Properties=Excel 8.0;";
DataSet ds = new DataSet();          
OleDbDataAdapter da = new OleDbDataAdapter("SELECT [name] FROM [Sheet1$] where Component=1 ", strConn);          
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;            
comboBox1.DataSource = ds.Tables[0].DefaultView;
comboBox1.DisplayMember = "name";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:03:42+00:00Added an answer on May 27, 2026 at 5:03 am

    You can assign value for ValueMember of combo box.

    OleDbDataAdapter da = new OleDbDataAdapter("SELECT [name],[value] FROM [Sheet1$] where Component=1 ", strConn);
    comboBox1.DisplayMember = "name";
    comboBox1.ValueMember = "value";
    comboBox1.BindingContext = this.BindingContext;
    

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a three columns Excel file,which has the following pattern 12 A P1
I have an excel file which has more than 65536 rows. However, I can
I have an excel file that has conditional formating set up to put a
I have an Excel file (which has data imported from Oracle 10G Database) one
I have an excel file which have a column name ( name ) which
I currently have a CSV file which, when opened in Excel, has a total
I have some URLs in an Excel file which I have saved as a
I have an Excel file with one column which is filled with numbers. I
I have an ASP.NET web application which does the following: Reads an Excel file.
I have written an Excel VBA macro which imports data from a HTML file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.