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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:58:39+00:00 2026-06-13T11:58:39+00:00

In my project, combobox values are coming in a method named getArticles. Here is

  • 0

In my project, combobox values are coming in a method named “getArticles”. Here is the method:

public void getArticles(ComboBox cb)
{
    var getAll = getAllFromDB("articles", "", "articleName ASC");
    DataTable dt = getAll.Tables["articles"];
    cb.DataSource = dt;
    cb.DisplayMember = "articleName";
    cb.ValueMember = "id";
}

“getAllFromDB” method is doing selection from articles table and returns DataSet. Now my problem is here. When i use cb.SelectedValue i can get id value of article name. This is Ok and good. But when i use cb.SelectedItem it is showing “System.Data.DataRowView”.
Please could you help me, how can i get article name like using cb.selectedItem?
Kind regards.

  • 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-13T11:58:39+00:00Added an answer on June 13, 2026 at 11:58 am

    Try the following codes of lines, may be it will help to get the selected item.

            ComboBoxItem requiredItem = (ComboBoxItem)cboType.SelectedItem;
            string value = requiredItem.Content.ToString();
    

    EDIT:

    Sorry, the above ComboBoxItem will only works in the case of .Net Framework 4.5, it is in System.Windows.Controls namespace. Refer to following code parts for your answer and check

            DataTable dtable = (DataTable)comboBox1.DataSource;
            label1.Text = dtable.Rows[comboBox1.SelectedIndex][0].ToString();//gives you article id
            label2.Text = dtable.Rows[comboBox1.SelectedIndex][1].ToString();//gives you article name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a combobox named cmbSubjects . It's purpose in my project is to
In my project i want to first view country in combobox then selecting country
For my project i want to implement a combobox with h:selectOneMenu . I read
I'm trying to create a combobox on a sean project and the sean tags
I have a datagrid control in my project which has a combobox control manually
I am using a databound dropdown list to populate a combobox with project iterations
This is a VB.NET winforms project, using EF. The ComboBox is bound to a
In my project there is an UI which contains a combobox and the combobox
I need a combobox for an ASP.NET project, so I decided to use the
I'm using a Silverlight 4.0 project that utilizes MVVM and we have a combobox

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.