Solved

How to select (and display selection in cell) a value from a DataGridViewComboBoxColumn.

Posted on 2012-04-12
1
321 Views
Last Modified: 2012-06-22
I am a developer who is new to the DataGridView object.  I have a task to modify an existing DataGridView object (myDGView), so that one of the columns displays a certain value under specific circumstances.  There are two columns in myDGView: unit and association.  Unit is a DataGridViewTextBoxColumn and association is a  DataGridViewComboBoxColumn.  The values of association are binded to a database lookup table (Values are: "X", Y", Z").  When the user changes the value of unit (column 0), I need to check all of the rows in the myDGView to determine if any association (column 1) value = "X".  If not, I must display "X" as the default selected value for the association column of the current row.  Can anyone assist?
0
Comment
Question by:spazjr01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
Minh Võ Công earned 500 total points
ID: 37840881
private void DataGridView1_CellValueChanged(
    object sender, DataGridViewCellEventArgs e)
{
    if (e.ColumnIndex == 0)
      {
            DataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = "X";
      }
}
0

Featured Post

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question