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 8635685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:02:30+00:00 2026-06-12T10:02:30+00:00

I have a xml file in my project. I am reading the file through

  • 0

I have a xml file in my project. I am reading the file through the below code in to combobox cbProduct. The problem is that the cbProduct is displaying duplicate text values. How to make them distinct?

I have gone through some links but there way of approach is not related to dataset.

I implemented the below code:

DataSet ds = new DataSet();
ds.ReadXml(@"..\..\stock.xml");
cbProduct.DataSource = ds.Tables[0];
cbProduct.DisplayMember = "productname";

optional: If you have time it will be appreciable if you explain the process because I am new to .net or provide a link atleast to refer (not msdn).

Please Help.

Thanks in advance.

  • 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-06-12T10:02:31+00:00Added an answer on June 12, 2026 at 10:02 am

    Do this

    DataSet ds = new DataSet();
    ds.ReadXml(@"..\..\stock.xml");
    DataTable dt = ds.Tables[0].DefaultView.ToTable(true, "productname");
    cbProduct.DataSource = dt;
    cbProduct.DisplayMember = "productname";
    

    Third code line creates a new table which will have distinct values based on productname column. For More read this

    This code is here

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

Sidebar

Related Questions

In my project.gwt.xml file I have <script src=http://maps.google.com/maps?gwt=1&amp;file=api&amp;v=2&amp;sensor=false;key=MYKEY /> But, when I load my
When I have an Eclipse update site project, a site.xml file is created which
I have the following defined in a file called build-dependencies.xml <?xml version=1.0 encoding=UTF-8?> <project
I have an XML file that looks like <?xml version=1.0> <playlist> <name>My Playlist</name> <song>
I have an XML file that reads like this <abc> <ab>value</ab> <aa>time</aa> <ac>money</ac> </abc>
I have an XML file that needs parsing in PHP. I am currenlty using
I'm reading configuration from an xml file. I have a property called linkType in
So I have an XML file in the format: <projectlist> <project> <name>test</name> <type>deploy</type> <environment>dev</environment>
I am trying to read data from an MS Project XML file. I have
I have a xml file that changed when i update some values, and i'm

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.