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

  • Home
  • SEARCH
  • 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 7014533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:32:01+00:00 2026-05-27T22:32:01+00:00

i have datagridview which has one combobox column. i populate combobox column. when i

  • 0

i have datagridview which has one combobox column. i populate combobox column. when i select any text from combobox column then i need to get the value when i read the data in for loop.

dgFilter is here datagridview

            DataGridViewComboBoxColumn dgcoSpec = new DataGridViewComboBoxColumn();
            dgcoSpec = new DataGridViewComboBoxColumn();
            dgcoSpec.DataSource = loadOperators();
            dgcoSpec.DisplayMember = "Operatortxt";
            dgcoSpec.ValueMember = "Operatorvalue";
            dgcoSpec.AutoComplete = true;
            dgcoSpec.HeaderText = "Operators";
            dgcoSpec.Name = "Operators";
            dgcoSpec.DefaultCellStyle.NullValue = "--Select--";
            dgcoSpec.Width = 130;
            dgFilter.Columns.Insert(1, dgcoSpec);

here this way i read data from combobox column

for (int i = 0; i <= dgFilter.Rows.Count - 1; i++)
{
  strOperator = dgFilter.Rows[i].Cells[1].Value.ToString().Trim();
}

but the problem is i am not getting the combox value member rather i am getting display member.
so how to extract value member from for loop. please guide me with code. thanks

  • 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-27T22:32:01+00:00Added an answer on May 27, 2026 at 10:32 pm

    The value member is the string that is displayed inside the DataGridViewComboboxCell.

    The actual Combobox control only exists during the time frame in which the user is editing the cell.

    If you mean that you would like to get the index of the value in the list of the DataGridViewComboboxCell items, you can query the index of the value:

    for (int i = 0; i <= dgFilter.Rows.Count - 1; i++)
    {
        var cell = dgFilter.Rows[i].Cells[1] as DataGridViewComboboxCell;
        int index = cell == null || cell.Value == null ? -1 : cell.Items.IndexOf(cell.Value);
        Console.WriteLine(index);
    }
    

    In this example, I am using -1 as an invalid value.

    EDIT Just noticed you are using a DataSource;
    See DataGridViewComboBoxColumn name/value how? for possible duplicate.

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

Sidebar

Related Questions

I have a DataGridView in which one column has data that the user needs
I have a DataGridView which is filling from Table in SQL Server Database. One
I have a datagridview in which one column contains a custom class, which I
Say I have a DataGridView in which I dynamically build up a ComboBox column
Question should be self explanatory. I have a datagridview which has a column whose
I have a DatagridView in which the first column is fixed and has TextBoxes.
I have a datagridview where the users can select which subset of columns to
I have a dataGrid(not dataGridView) in which i need to add Checkbox dynamically at
I have a DataGridView which has different rows and columns and it work perfectly
I have a Winform DataGridView , which has a number of predefined columns. Now

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.