Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object reference from a separate file in C#
Message
From
28/03/2013 11:46:00
 
 
To
28/03/2013 05:51:46
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
Miscellaneous
Thread ID:
01569423
Message ID:
01569450
Views:
31
>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 ?
Previous
Reply
Map
View

Click here to load this message in the networking platform