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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:52:50+00:00 2026-05-25T11:52:50+00:00

How to make a datagrid view cell not selected at form load for this

  • 0

How to make a datagrid view cell not selected at form load for this

I have tried too much

my dgvproducts properties are (readonly = false,selection mode = CellSelect)

1) i have place this code in form shown event but that does not work for me ..

         dgvProducts.Clearselection();

2) I have place the above code in databinding event like the below..

     private void dgvProducts_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
     {
         //dgvProducts.ClearSelection();
         ((DataGridView)sender).ClearSelection();
     }

it does not work for me …

3) i have placed similar code and i have added extra line to that in form load event but does not work for me ..

  dgvProducts.ClearSelection();
  dgvProducts.currentcell = null;

but this is not work for me ….

this is my form load code

      private void SellEquipment_Load(object sender, EventArgs e)
      {
            getProductDetails();
            dgvProducts.Columns[0].Visible = false;

            for (int i = 0; i < dgvProducts.Columns.Count; i++)
            if (dgvProducts.Columns[i] is DataGridViewImageColumn)
            {
                ((DataGridViewImageColumn)dgvProducts.Columns[i]).ImageLayout = DataGridViewImageCellLayout.Stretch;
                break;
            }
      }

and this is my getproductdetails code

   private void getProductDetails()
   {
        var products = from productlist in dbcontext.products
                       select new
                       {
                           productid = productlist.productId,
                           Name = productlist.Name,
                           Image = productlist.Image,
                           Description = productlist.Description,
                           Price = productlist.Price
                       };

        BindingProductsource.DataSource = products;
        dgvProducts.DataSource = BindingProductsource;
        dgvProducts.ClearSelection();         
   }

would any one pls help on this..

Many 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-25T11:52:51+00:00Added an answer on May 25, 2026 at 11:52 am

    Try creating a new event OnShow and do this code:

        protected override void OnShown(EventArgs e)
        {
            if (this.dataGridView1.SelectedCells.Count > 0)
            {
                for (int i = 0; i < this.dataGridView1.SelectedCells.Count; i++)
                    this.dataGridView1.SelectedCells[i].Selected = false;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to make a DataGridView have no cell selected? I notice
Im using c# .net windows form application. i have a datagrid view. It has
I have a view with this snippet: <DataGrid AlternatingRowBackground=#FFF2F5F1 AutoGenerateColumns=False Grid.Row=0 GridLinesVisibility=None IsReadOnly=False IsSynchronizedWithCurrentItem=True
When I first load data into a Silverlight DataGrid control, how can I make
I have a datagrid bound to a CollectionViewSource view in my view model. The
I have a Datagridview cell with some text in. I'd like to make just
I have two columns in dataGrid view : Price Amount and a third column
I have researched this and am stumped: I have a WPF DataGrid, and using
I have a custom control that is derived from ListView . This list view
make is not only useful for building your programming project, but it seems to

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.