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

The Archive Base Latest Questions

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

How can I perform validation on a particular DataGridViewTextBoxColumn column in my DataGridView, so

  • 0

How can I perform validation on a particular DataGridViewTextBoxColumn column in my DataGridView, so that a user is required to enter a value into it?

  • 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-25T21:32:14+00:00Added an answer on May 25, 2026 at 9:32 pm

    i think you are looking for datagrid view text box column validation right ? if so would you pls take a look at this link

    http://www.codeproject.com/Questions/93691/Validations-inside-DataGridView-TextboxColumn.aspx

    EDIT 1:

    you Can use this solution but it validates only numbers ,or if you want to validate the text you can change the code..

    private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
    {
        DataGridViewTextBoxCell cell = dataGridView1[2, e.RowIndex] as DataGridViewTextBoxCell;
    
        if (cell != null)
        {
             if (e.ColumnIndex == 2)
             {
                 char[] chars = e.FormattedValue.ToString().ToCharArray();
                 foreach (char c in chars)
                 {
                      if (char.IsDigit(c) == false)
                      {
                               MessageBox.Show("You have to enter digits only");
    
                               e.Cancel = true;
                               break;
                        }
                  }
              }
         }
    }
    

    NOTE: this code is not tested ..

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

Sidebar

Related Questions

I've written a small console application that can perform certain tasks. The user interface
It seems that org.hibernate.cfg.Configuration object can be used to perform validation programmatically, by calling
How can I require the Address element? If I perform an XSD validation on
can anyone suggest me a plugin/tool that can perform a code formatting at build
I have a MDI WinForms application that can perform several tasks. Each task is
Let's assume that our system can perform actions, and that an action requires some
Let's say you have a business logic method that can perform some operation across
How can I perform a text validation on a textbox in form written in
Is it possible to perform the local Validation for iOS applications (which can be
we can perform vim substitute on a set of lines by selecting them in

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.