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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:39:21+00:00 2026-05-20T03:39:21+00:00

i have one datagridview.in my datagridview is having four row and three columns.after enter

  • 0

i have one datagridview.in my datagridview is having four row and three columns.after enter the one row. that row one coloumns value repeat (or) same in second row columns value.so,how to find out the which value is repeat and which row.

  • 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-20T03:39:21+00:00Added an answer on May 20, 2026 at 3:39 am

    If your grid data is mainly text then maintain a List<string> that holds all of the values being inserted in the DataGridView.

    So every time data was entered in a cell (there are events you can handle for that, like CellEndEdit or CellLeave), you check if it is in your list of strings before you add it.

    If it is, then you found a value already contained within the grid.

    EDIT
    Here is some sample code:

    private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
    {
       string cellVal = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
       if (String.IsNullOrEmpty(listGridVals.Find(delegate(string s) { return s == cellVal; })))
           listGridVals.Add(cellVal);
       else
           MessageBox.Show("Value: " + cellVal + " already in the grid!");
    
    }
    

    NOTE

    This routine is very basic, it only checks if values being entered in the grid are
    already in the List<string>.

    However, let’s say that you already have value test in one cell and already in the List<string>.

    What happens when you delete that value and enter a test1 ? Well, test will still be in List<string> and next time you enter test in another cell you’ll get the MessageBox saying there is already a test in the grid, which could be wrong.

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

Sidebar

Related Questions

I have a DataGridView that has three read only columns in it and one
I have a winforms datagridview that seems to always have at least one row
I have a DataGridView having one DataGridViewComboBoxColumn and I have populated that ComboBox but
I have three column in my datagridview .One is text ,one is Combo and
I have a DataGridView where one of the columns is a DataGridViewComboBoxColumn . When
I have a datagridview with a number of columns, one of these is a
In VB.net 3.5 SP1 I have a Windows Form with three DataGridView controls. One
I have a DataGridView in which one column has data that the user needs
I have few columns in my DataGridView, one of them is an unbound column
I have readonly datagridview, I need in some specific case enable one cell after

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.