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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:18:48+00:00 2026-06-07T01:18:48+00:00

I have a windows form with 3 comboboxes and a XML file as following

  • 0

I have a windows form with 3 comboboxes and a XML file as following

<?xml version="1.0"?>
<shrtcutkeys>
    <Keysmain>
        <keychars>
            <key1>
                Ctrl
            </key1>
            <key1>
                Alt
            </key1>
            <key1>
                Shift
            </key1>
        </keychars>
    </Keysmain>
    <Seckeys>
        <keychars>
            <key2>
                Ctrl
            </key2>
            <key2>
                Alt
            </key2>
            <key2>
                Shift
            </key2>
        </keychars>
    </Seckeys>
    <Alphas>
        <keychars>
            <key3>
                a
            </key3>
            <key3>
                b
            </key3>
            <key3>
                c
            </key3>
        </keychars>
    </Alphas>
</shrtcutkeys>

So i would like to display all key1 in combobox1 and all key2 in combox2 and so on so forth..tried doing this but not really working

DataSet dsSet = new DataSet();
            dsSet.ReadXml("C:\\Users\\jackandjill\\Documents\\Visual Studio 2010\\Projects\\highlite\\highlite\\keys.xml");
            comboBox1.DataSource = dsSet.Tables["keys"];
            comboBox1.DisplayMember = "key1";  
  • 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-07T01:18:49+00:00Added an answer on June 7, 2026 at 1:18 am

    I prefer to use Linq2XML:

    Load the data into an XDocument:
    Either load from file:

    var xmlDocument = XDocument.Load(fileName);
    

    or load from a string

    var xmlDocument = XDocument.Parse( @"<?xml version=""1.0""?>
    <shrtcutkeys>
        <Keysmain>
            <keychars>
                <key1>
                    Ctrl
                </key1>
                <key1>
                    Alt
                </key1>
                <key1>
                    Shift
                </key1>
            </keychars>
        </Keysmain>
        <Seckeys>
            <keychars>
                <key2>
                    Ctrl
                </key2>
                <key2>
                    Alt
                </key2>
                <key2>
                    Shift
                </key2>
            </keychars>
        </Seckeys>
        <Alphas>
            <keychars>
                <key3>
                    a
                </key3>
                <key3>
                    b
                </key3>
                <key3>
                    c
                </key3>
            </keychars>
        </Alphas>
    </shrtcutkeys>");
    

    Then you can select desired items

    var mainItems = from key in xmlDocument.Descendants("key1")
                    select key.Value;
    var secKeyItems = from key in xmlDocument.Descendants("key2")
                    select key.Value;
    var alphaItems = from key in xmlDocument.Descendants("key3")
                    select key.Value;
    

    You can now bind each combo to the selected result, like this:

    comboBox1.DataSource = mainItems.ToList();
    

    You might want to wash your XML (to remove newlines and spaces)

    var mainItems = from key in xmlDocument.Descendants("key1")
                    select key.Value.Trim();
    var secKeyItems = from key in xmlDocument.Descendants("key2")
                    select key.Value.Trim();
    var alphaItems = from key in xmlDocument.Descendants("key3")
                    select key.Value.Trim();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one windows form file that each time I open it in Visual
I have a Windows Form application. Version 1 of my app has been released
Im using c# .net windows form application. I have two comboboxes A and B
Background I have a Windows Form with the following items: ComboBox TextBox Two Buttons
I have a windows form and user select cloth parameters from comboboxes like country-state-city
VB.NET 2008 windows app form. I have a groupbox with several checkboxes, comboboxes, and
I have .Net 2.0 Windows form containing combobxes. I have written following code to
I am using windows application and I have four combo boxes(comboeventname,combosendtype,comboType,comboschedule) in that form....
I have a System.Windows.Forms.ComboBox on a form and I want to capture the event
I have a windows form application. On the form there are three groupboxs. Each

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.