473,473 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Accessing controls of Windows Form

I have a data grid on a windows form that I want to access from another class that's outside the form but in the same project. This other class stores all methods that populate and modify the grid on my form - it basically contains all the logic behind the form. I will be calling these methods from the form class but am not sure how I can access the datagrid from outside the form.

Should my class inherit the form so that it has access to the controls or is there another way of doing this

Thanks for the help!
Nov 20 '05 #1
2 1202
If the datagrid is declared with "Friend" scope, and it is loaded in memory
at the same time the other class is running, you should be able to refer to
it via the form it is on: Form1.DataGrid1.property.
"Parveen" <an*******@discussions.microsoft.com> wrote in message
news:48**********************************@microsof t.com...
I have a data grid on a windows form that I want to access from another class that's outside the form but in the same project. This other class
stores all methods that populate and modify the grid on my form - it
basically contains all the logic behind the form. I will be calling these
methods from the form class but am not sure how I can access the datagrid
from outside the form.
Should my class inherit the form so that it has access to the controls or is there another way of doing this?
Thanks for the help!

Nov 20 '05 #2
I tried this but I'm not able to reference the grid from the form that it is on.

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jim Heavey | last post by:
Hello, I have created a form which I intend to use a a dialog box. It has a few controls on that form and I changed the properties of those controls to "public" with the idea that I could access...
5
by: RSH | last post by:
I havent been able to set a property from another class with out getting some sort of error. Can someone please tell me what I'm doing wrong here? Public Class Form1
7
by: Sudhakara.T.P. | last post by:
Hi, I have an tab control in one of the forms and it has two tab strips. Now I have written an general function that accepts form name as parameter and iterates through all the controls in the...
3
by: DotNetNewbie | last post by:
I am reading the book Teach Yourself Microsoft Visual Basic .Net 2003 in 21 Days. I am having trouble getting one of the exercises to work at the end of day 4. Exercises: 1. Create a new...
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
2
by: ranjithchev | last post by:
Hi, I have a C# windows form. Initially i might have just a Label and a Text Box present on the form. Then later when there are new requirements i might be adding additional UI controls. ...
8
by: Masterfrier | last post by:
Hello Experts! ;-) I am fairly new to C#, and have this problem.... on my form, i have some controls (imagelist, etc..) from another class, i need to access imageList1 Here is a snippet...
0
by: porksmash | last post by:
I'm developing an app here that uses ActiveX controls to connect to industrial cameras over Ethernet. I want to be able to dynamically create those controls at runtime based on how many cameras are...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.