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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:29:44+00:00 2026-06-14T07:29:44+00:00

For example, i have a class (User) and 30 values (properties), 10 of them

  • 0

For example, i have a class (User) and 30 values (properties), 10 of them i display in DataGridView as columns, but other (settings for each user (timeout to make requests for example, any other BL values)) about 20 values, i just want to store together in XML file (i could make Serialize/Deserialize).

So, i need to store anywhere this not displayed 20 values, what is the best practise for this?
Is it hidden column in DataGridView or anything else?

As i could understand, i have to store it together, but where i could do it? Should i make relationship between two block of stored data (User[10 values] + User[20 values]) to make them after that serialize in XML?

  • 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-06-14T07:29:46+00:00Added an answer on June 14, 2026 at 7:29 am

    The best practice as I have used frequently, is to retrieve all your data in a collection like List, DataTable, EntityCollection, ... or any IEnumerable Type and bind it to your DataGridView which has AutoGenerateColumns = false. In this case you should have manually added the specific columns to the DataGridView in designer or code. The code approach would be like this:

    // say this is your User class with 9 fields
    public class User
    {
        public string Name { get; set; }
        public string LastName { get; set; }
        public string FatherName { get; set; }
        public string Telephone { get; set; }
        public string Mobile { get; set; }
        public string Username { get; set; }
        public string Password { get; set; }
        public bool IsActive { get; set; }
        public DateTime LastLoginDate { get; set; }
    }
    // and your Form1 class would be like this
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
    
            dataGridView1.AutoGenerateColumns = false;
            // say you want to show, only the first 5 fields of your Entity
            dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Name", DataPropertyName = "Name", Width=100 });
            dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Last Name", DataPropertyName = "LastName", Width = 100 });
            dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Father's Name", DataPropertyName = "FatherName" });
            dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Telephone", DataPropertyName = "Tel", Width = 50 });
            dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Mobile", DataPropertyName = "Mobile", Width = 50 });
        }
    
        private void Form1_Load(object sender, EventArgs e)
        {
            List<User> list = new List<User>();
    
            list.Add(new User { Name="aaa", LastName="bbbb", FatherName="ccc", Tel="01111", Mobile="099999" });
    
            dataGridView1.DataSource = list.ToArray();
        }
    }                        
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model defined as below: class Example(models.Model): user = models.ForeignKey(User, null=True) other
for example I have the following: I want to go through each div class
I have a few questions related to the design of my User class but
I have a class (USER) which has the following properties (NSString name, NSString address,
Example: I have an class that inherits from UIImageView. An object creates an instance
For example can I have class Dog { int legs; Bone chewy; Bone squeeky;
Example I have a repository class (DAL): public class MyRepository : IMyRepository { public
Example-I have a person class Public Class Person Private _fname As String Public Property
I have an example class containing two data points: public enum Sort { First,
For example is it better to have: public class Case : EntityIdentifiable { public

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.