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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:44:51+00:00 2026-05-16T05:44:51+00:00

Again a c# question I cant’t seem to figure out: I have a datagridview

  • 0

Again a c# question I cant’t seem to figure out:

I have a datagridview on my form. In Visual Studio design mode, I enter 4 columns: refernce, country, name & city.
After a searchform is filled in, I try to refresh the datasource: A custom class fetches all the data from the selected table and fills the datagridview. The problem is: the datagridview now has all the columns of the table, and I only want the 4 columns entered in design mode.

I can put all the other columns on visible = false in design mode, and that works. But I want this datagridview as a custom control. So I only want to show the 4 entered columns, without disabling all the others. The data which is invisible is used to bind to a panel with other Controls like TextBoxes.

Does somebody know if this is possible, and how I should try to solve this?

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-16T05:44:52+00:00Added an answer on May 16, 2026 at 5:44 am

    You have three ways of hide columns.

    1.- setting the visible property to false (as ksogor said) and don’t create columns in design mode. Note that

    GridView1.Columns["ColumnName"].Visible = false;
    

    is more readable and mantenible that

    GridView1.Columns[1].Visible = false; 
    

    2.- setting AutoGenerateColumns to false and create columns in the designer

    3.- in your class, set the attribute [Browsable(false)] in the fields you don’t want to show. Don’t create columns in design mode.

    The third way will hide the column in all the datagrids of your app. I love it.

    [Browsable(false)]
    public string Something{get;set;}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quick question that I can't figure out. I've tried searching Google
I have a really weird bug and cant figure out why things are not
Once again a question about the garbage collector in actionscript-3: If I have a
Again I have a question regarding this plugin: http://t.wits.sg/2008/06/20/jquery-progress-bar-11/ What I want to achieve
I have a question I cant find an answer to anywhere. Suppose I have
i have asked this question before but no answer was there. so asking again.
So, in my last question (Can't figure out how to overlap images in java)
Sorry I have had to submit this question again because I have had hardly
Hey all, Sorry its me again. This time I have a question that I
I regret to ask this question again. I am trying to implement autocomplete on

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.