Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object reference from a separate file in C#
Message
De
28/03/2013 11:46:00
 
 
À
28/03/2013 05:51:46
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
Divers
Thread ID:
01569423
Message ID:
01569450
Vues:
30
>I created a form and a grid on it and there is a separate class file too in the project.
>Can I reference to the grid from the class file? If I can, how?
>Thanks

As Marc suggests you can do something like this:
public class ClassAccessingGrid
    {
        private DataGridView _theGrid;

        public ClassAccessingGrid(DataGridView theGrid)
        {
            _theGrid = theGrid;
        }
    }
and in the form:
private ClassAccessingGrid _caf;
        public Form1()
        {
            InitializeComponent();
            _caf= new ClassAccessingGrid(this.NameofTheGrid);
        }
But what does (or will) the class actually do ?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform