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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:34:25+00:00 2026-05-23T21:34:25+00:00

I have a list of data in datagridview. For example, one column is named

  • 0

I have a list of data in datagridview. For example, one column is named Class (each row has a different value, see below), is it possble that to have a combo box, that contains all of the possible record Class values in the combo box? *It should be have a list of 6A, 6B, 6C
If more classes are added to the database later (example 6D), these should also be in the combobox.
*

A view of datagridview

Class              Name

6A                  Jane,14 May 1980;Mary,4 June 1980; 
6B                  leen, 31 May 1980; Peter 6 Jan 1980;
6C                  Eillen, 19 Aug 1980; Yvwon, 28 Mar 1980;
6D                  Evan, 24 Dec 1980; Ivan, 20 Nov 1980;

Here is the code i found, but how do I change it to what i want?

var input = Convert.ToString(datagridview1.CurrentRow.Cells[0].Value);
var resultList = Regex.Matches(input, **@".*?,(.*?),.*?;")**
    .Cast<Match>()
    .Select(arg => arg.Groups[1].Value)
    .ToList();



// bind to a combobox
comboBox1.DataSource = resultList;
  • 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-23T21:34:25+00:00Added an answer on May 23, 2026 at 9:34 pm

    If this is a Windows Forms app then you can create a class, similar to

    class Obj {
        public string Class { get; set; }
        public string Data { get; set; }
    }
    

    then create a list of objects:

    var list = new List<Obj>();
    list.Add(new Obj() { Class = "6A", Data = "Jane,14 May 1980;Mary,4 June 1980;" });
    // continue adding to the list here
    

    and then

    comboBox1.DataSource = list;
    comboBox1.DisplayMember = "Class";
    

    And finally hook your comboBox1.SelectedIndexChanged to an event and grab the comboBox1.SelectedItem, cast it to Obj and you’re good.

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

Sidebar

Related Questions

I have a list of data that is a schedule. Each item has a
I have gridview, it's datasource is list<string> and I added one checkbox column to
I have a datagridview which is bound to some data. One of the fields
At runtime, I have a collection of rows ( Row class). Each of them
I have a list of data that looks like the following: // timestep,x_position,y_position 0,4,7
If I have a list of data in a text file seperated by a
I have a long list of data that I want to display in table
I have some C structures related to a 'list' data structure. They look like
I'm trying to access list data using SSRS 2008. I have created an XML
i have a doubt in grid view. In Data list we have a property

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.