Visual Studio 2003 / C#
My application has 1 main form. On this form is a treeview object down the
left hand edge and a status bar along the bottom. That is all. The tree
view acts as my menu controller, and when the users click an item, I generate
instances of various UserControls I have for each of the menu items, and add
an instance to the Main form in the right hand area. Some of these
UserControls are just single page objects with fields and buttons etc on
them. Some are a UserControl which for example has a datagrid on page 1,
then another UserControl on page 2 to represent the selected data in this
datagrid on page 1.
I want to be able to publish messages and text to the status bar on my main
form at any point from anywhere in my application. I can achieve this by
passing the "this" value around between objects, then maybe use reflection to
call a method in my main form. But this seems a little lame to me. In
previous languages I have worked with, there has been a Global Parameters
methodology, where I could for example set and get a global property for
"this", then call my setMessage function using this, without the need to pass
it around my objects. Is this possible in .Net? A top level always
available set of parameters?
Thanks 3 1699
Steve - if you mark a property as public static, you can access it from
anywhere in the application. Is this the sort of functionality you were
looking for? If not, I may have misunderstood the goal so please forgive
me.
"Steve" <St***@discussions.microsoft.com> wrote in message
news:16**********************************@microsof t.com... Visual Studio 2003 / C#
My application has 1 main form. On this form is a treeview object down the left hand edge and a status bar along the bottom. That is all. The tree view acts as my menu controller, and when the users click an item, I generate instances of various UserControls I have for each of the menu items, and add an instance to the Main form in the right hand area. Some of these UserControls are just single page objects with fields and buttons etc on them. Some are a UserControl which for example has a datagrid on page 1, then another UserControl on page 2 to represent the selected data in this datagrid on page 1.
I want to be able to publish messages and text to the status bar on my main form at any point from anywhere in my application. I can achieve this by passing the "this" value around between objects, then maybe use reflection to call a method in my main form. But this seems a little lame to me. In previous languages I have worked with, there has been a Global Parameters methodology, where I could for example set and get a global property for "this", then call my setMessage function using this, without the need to pass it around my objects. Is this possible in .Net? A top level always available set of parameters?
Thanks
Possibly, I'm not too sure what you mean though. Do I setup a public static
property in my MainMenu form to set the text property on my StatusBar? Can I
then set this property from other objects in my project?
Thanks
Steve
"W.G. Ryan MVP" wrote: Steve - if you mark a property as public static, you can access it from anywhere in the application. Is this the sort of functionality you were looking for? If not, I may have misunderstood the goal so please forgive me. "Steve" <St***@discussions.microsoft.com> wrote in message news:16**********************************@microsof t.com... Visual Studio 2003 / C#
My application has 1 main form. On this form is a treeview object down the left hand edge and a status bar along the bottom. That is all. The tree view acts as my menu controller, and when the users click an item, I generate instances of various UserControls I have for each of the menu items, and add an instance to the Main form in the right hand area. Some of these UserControls are just single page objects with fields and buttons etc on them. Some are a UserControl which for example has a datagrid on page 1, then another UserControl on page 2 to represent the selected data in this datagrid on page 1.
I want to be able to publish messages and text to the status bar on my main form at any point from anywhere in my application. I can achieve this by passing the "this" value around between objects, then maybe use reflection to call a method in my main form. But this seems a little lame to me. In previous languages I have worked with, there has been a Global Parameters methodology, where I could for example set and get a global property for "this", then call my setMessage function using this, without the need to pass it around my objects. Is this possible in .Net? A top level always available set of parameters?
Thanks
Yes, that worked fine. I declared the statusbar panels as private static,
and created a public static method which recieves a string, and sets the
panel text to this string. Then wherever I want to set a message in the
status bar I just call the MainMenu.SetSystemMessage method.
Thanks a lot
Steve
"W.G. Ryan MVP" wrote: Steve - if you mark a property as public static, you can access it from anywhere in the application. Is this the sort of functionality you were looking for? If not, I may have misunderstood the goal so please forgive me. "Steve" <St***@discussions.microsoft.com> wrote in message news:16**********************************@microsof t.com... Visual Studio 2003 / C#
My application has 1 main form. On this form is a treeview object down the left hand edge and a status bar along the bottom. That is all. The tree view acts as my menu controller, and when the users click an item, I generate instances of various UserControls I have for each of the menu items, and add an instance to the Main form in the right hand area. Some of these UserControls are just single page objects with fields and buttons etc on them. Some are a UserControl which for example has a datagrid on page 1, then another UserControl on page 2 to represent the selected data in this datagrid on page 1.
I want to be able to publish messages and text to the status bar on my main form at any point from anywhere in my application. I can achieve this by passing the "this" value around between objects, then maybe use reflection to call a method in my main form. But this seems a little lame to me. In previous languages I have worked with, there has been a Global Parameters methodology, where I could for example set and get a global property for "this", then call my setMessage function using this, without the need to pass it around my objects. Is this possible in .Net? A top level always available set of parameters?
Thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Toby |
last post by:
I've a DataAdapter with:
SELECT ID, Employee, , Period_End_Date, Job, Description, Exported,
Units, Cost_Code, Category, Class, Chargeout_Level, PayID, Rate
FROM tblTimeEntry
WHERE ...
|
by: Michael |
last post by:
Hi newsgroup,
as the subject indicates I am looking for an advice
using global variables. I am not if this problem is more
about style then C. If its wrong in thi group, sorry.
So I have a...
|
by: Rob Wire |
last post by:
Please let me know the preferred way to do the following.
Accept a Variable in the calling page's URL of an ID. Set
that variable to be global scope of the class so that it
can be used throughout...
|
by: gordonfmoore |
last post by:
Hi,
for some reason? I learnt it was sensible/useful to put any parameters
that I wanted users to be able to change in the global.asax file.
So my code would look like:
//in my page load...
|
by: JohnT |
last post by:
Okay... I'm using VB.net (2003) and I am accessing an MS Access DB file.
I have two DataAdapters that I use to search for specific info. The two of
them are similar except one is a Date, the...
|
by: newbie |
last post by:
Hello,
I have questions about global variables in OOP (in general) and Python
(in specific). I understand (I think) that global variables are
generally not a good idea. However, if there are...
|
by: eoindeb |
last post by:
Sorry to ask another global variable question, but from reading other
posts I'm still not sure whether to use them or not.
I have a program with a set function that calls 4 other functions in...
|
by: tshad |
last post by:
I have my error handling set up in Global.asax:
Sub Application_Error(Sender As Object, E as EventArgs)
In this procedure I call a function in a dll that will write out to a
history file.
...
|
by: arun1985 |
last post by:
In the project i am using i am having the following code and when i upload it to the server.Its givig me the following error in the global.cs file.
Server Error in '/' Application. ...
|
by: =?Utf-8?B?bWNxd2VydHk=?= |
last post by:
Hello,
I'm trying to enable an error handling package at the root of my web server
by editing this file:
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\CONFIG\web.config
In the httpHandlers...
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
|
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 ...
| |