Hello,
I am trying to manipulate the properties of a form's controls from a class.
I dont want to make the form's control public.
Attached is a code snippet of what I am trying to accomplish:
Public Form1()
public void SetLabel4Text(string theText)
{
label4.Text = theText;
}
---
class clsDataLayer
Form1.SetLabel4Text("Hello World");
When I try to do this, I get invalid token '(' in class, struct, or
interface member declaration
Is what I am attempting to do invalid? 9 1998
your supporting classes shouldnt really be manipulating ur presentation layer
hey.
I agree with you. However, the presentation layer needs to know the
status of a function in process (attempting to connect to a database
server). Prior to the connection, the presentation layer displays "Not
yet connected" (by default).
The presentation layer calls a function in the data access layer to
attempt to connect to the database. I need a way to tell the user (by
updating the label) that the application is "Attempting to connect to
the database." The presentation layer cant query the function in
progess, only before or after. So as of now, the GUI can get a
response from the data layer when we are "Not yet connected" and when
we have "Connection Established" and when we have "Connection Error",
but I have not yet figured out how to tell the GUI "Attempting to
connect" while the data layer is actually attempting the connection.
Any ideas?
XOR wrote:
your supporting classes shouldnt really be manipulating ur presentation layer
hey.
you could pass your label control 'by reference' to your function and then
use the parameter object to update its text?
Seems like you could use event handlers somehow. Like
add a change event handler to a property in a class, say in your
business layer. Have the DAL change the property, and
have the form change the label when the property changes.
Something like that. If you want to be truly disconnected,
I mean.
I'm sure others will chime in if this is an incredibly
stupid idea. I will claim the lateness of the hour as
my excuse.
Robin S.
------------------------------
<ti******@hotmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
>I agree with you. However, the presentation layer needs to know the
status of a function in process (attempting to connect to a database
server). Prior to the connection, the presentation layer displays
"Not
yet connected" (by default).
The presentation layer calls a function in the data access layer to
attempt to connect to the database. I need a way to tell the user (by
updating the label) that the application is "Attempting to connect to
the database." The presentation layer cant query the function in
progess, only before or after. So as of now, the GUI can get a
response from the data layer when we are "Not yet connected" and when
we have "Connection Established" and when we have "Connection Error",
but I have not yet figured out how to tell the GUI "Attempting to
connect" while the data layer is actually attempting the connection.
Any ideas?
XOR wrote:
>your supporting classes shouldnt really be manipulating ur presentation layer hey.
Can you give me an example?
XOR wrote:
you could pass your label control 'by reference' to your function and then
use the parameter object to update its text?
So,
The UI layer will subscribe to specific events in the data access layer and
process changes to the label based on event notifications?
-Tirrell
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:ou******************************@comcast.com. ..
Seems like you could use event handlers somehow. Like
add a change event handler to a property in a class, say in your
business layer. Have the DAL change the property, and
have the form change the label when the property changes.
Something like that. If you want to be truly disconnected,
I mean.
I'm sure others will chime in if this is an incredibly
stupid idea. I will claim the lateness of the hour as
my excuse.
Robin S.
------------------------------
<ti******@hotmail.comwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
>>I agree with you. However, the presentation layer needs to know the status of a function in process (attempting to connect to a database server). Prior to the connection, the presentation layer displays "Not yet connected" (by default).
The presentation layer calls a function in the data access layer to attempt to connect to the database. I need a way to tell the user (by updating the label) that the application is "Attempting to connect to the database." The presentation layer cant query the function in progess, only before or after. So as of now, the GUI can get a response from the data layer when we are "Not yet connected" and when we have "Connection Established" and when we have "Connection Error", but I have not yet figured out how to tell the GUI "Attempting to connect" while the data layer is actually attempting the connection. Any ideas?
XOR wrote:
>>your supporting classes shouldnt really be manipulating ur presentation layer hey.
Right. That's my theory. Then if you changed the UI, you
could ignore the raised event by not subscribing to it,
and wouldn't have to change your DAL, which is the point
of separating them, after all.
Robin S.
--------------------------------
"tirrell payton" <ti******@nospam.hotmail.comwrote in message
news:45**********************@roadrunner.com...
So,
The UI layer will subscribe to specific events in the data access
layer and process changes to the label based on event notifications?
-Tirrell
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:ou******************************@comcast.com. ..
>Seems like you could use event handlers somehow. Like add a change event handler to a property in a class, say in your business layer. Have the DAL change the property, and have the form change the label when the property changes. Something like that. If you want to be truly disconnected, I mean.
I'm sure others will chime in if this is an incredibly stupid idea. I will claim the lateness of the hour as my excuse.
Robin S. ------------------------------
<ti******@hotmail.comwrote in message news:11**********************@79g2000cws.googlegr oups.com...
>>>I agree with you. However, the presentation layer needs to know the status of a function in process (attempting to connect to a database server). Prior to the connection, the presentation layer displays "Not yet connected" (by default).
The presentation layer calls a function in the data access layer to attempt to connect to the database. I need a way to tell the user (by updating the label) that the application is "Attempting to connect to the database." The presentation layer cant query the function in progess, only before or after. So as of now, the GUI can get a response from the data layer when we are "Not yet connected" and when we have "Connection Established" and when we have "Connection Error", but I have not yet figured out how to tell the GUI "Attempting to connect" while the data layer is actually attempting the connection. Any ideas?
XOR wrote: your supporting classes shouldnt really be manipulating ur presentation layer hey.
I understand the theory behind it perfectly, but I have no idea how to
implement it.
Can you show me an example of the following:
Datalayer class raises event 1
Datalayer class raises event 2
UI class catches event and changes a label to "event 1"
UI class catches event and changes a label to "event 2"
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:vv******************************@comcast.com. ..
Right. That's my theory. Then if you changed the UI, you
could ignore the raised event by not subscribing to it,
and wouldn't have to change your DAL, which is the point
of separating them, after all.
Robin S.
--------------------------------
"tirrell payton" <ti******@nospam.hotmail.comwrote in message
news:45**********************@roadrunner.com...
>So,
The UI layer will subscribe to specific events in the data access layer and process changes to the label based on event notifications?
-Tirrell
"RobinS" <Ro****@NoSpam.yah.nonewrote in message news:ou******************************@comcast.com ...
>>Seems like you could use event handlers somehow. Like add a change event handler to a property in a class, say in your business layer. Have the DAL change the property, and have the form change the label when the property changes. Something like that. If you want to be truly disconnected, I mean.
I'm sure others will chime in if this is an incredibly stupid idea. I will claim the lateness of the hour as my excuse.
Robin S. ------------------------------
<ti******@hotmail.comwrote in message news:11**********************@79g2000cws.googleg roups.com... I agree with you. However, the presentation layer needs to know the status of a function in process (attempting to connect to a database server). Prior to the connection, the presentation layer displays "Not yet connected" (by default).
The presentation layer calls a function in the data access layer to attempt to connect to the database. I need a way to tell the user (by updating the label) that the application is "Attempting to connect to the database." The presentation layer cant query the function in progess, only before or after. So as of now, the GUI can get a response from the data layer when we are "Not yet connected" and when we have "Connection Established" and when we have "Connection Error", but I have not yet figured out how to tell the GUI "Attempting to connect" while the data layer is actually attempting the connection. Any ideas?
XOR wrote: your supporting classes shouldnt really be manipulating ur presentation layer hey.
Well, I can implement it in VB, but I don't do C# very well.
Would that help anyway?
Robin S.
-------------------------------------
"tirrell payton" <ti******@nospam.hotmail.comwrote in message
news:45**********************@roadrunner.com...
>I understand the theory behind it perfectly, but I have no idea how to implement it.
Can you show me an example of the following:
Datalayer class raises event 1
Datalayer class raises event 2
UI class catches event and changes a label to "event 1"
UI class catches event and changes a label to "event 2"
"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:vv******************************@comcast.com. ..
>Right. That's my theory. Then if you changed the UI, you could ignore the raised event by not subscribing to it, and wouldn't have to change your DAL, which is the point of separating them, after all.
Robin S. --------------------------------
"tirrell payton" <ti******@nospam.hotmail.comwrote in message news:45**********************@roadrunner.com...
>>So,
The UI layer will subscribe to specific events in the data access layer and process changes to the label based on event notifications?
-Tirrell
"RobinS" <Ro****@NoSpam.yah.nonewrote in message news:ou******************************@comcast.co m... Seems like you could use event handlers somehow. Like add a change event handler to a property in a class, say in your business layer. Have the DAL change the property, and have the form change the label when the property changes. Something like that. If you want to be truly disconnected, I mean.
I'm sure others will chime in if this is an incredibly stupid idea. I will claim the lateness of the hour as my excuse.
Robin S. ------------------------------
<ti******@hotmail.comwrote in message news:11**********************@79g2000cws.google groups.com... >I agree with you. However, the presentation layer needs to know >the status of a function in process (attempting to connect to a database server). Prior to the connection, the presentation layer displays "Not yet connected" (by default). > The presentation layer calls a function in the data access layer to attempt to connect to the database. I need a way to tell the user (by updating the label) that the application is "Attempting to connect to the database." The presentation layer cant query the function in progess, only before or after. So as of now, the GUI can get a response from the data layer when we are "Not yet connected" and when we have "Connection Established" and when we have "Connection Error", but I have not yet figured out how to tell the GUI "Attempting to connect" while the data layer is actually attempting the connection. Any ideas? > XOR wrote: >your supporting classes shouldnt really be manipulating ur >presentation layer >hey. > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Amir Eshterayeh |
last post by:
Dear Friends
Hope things goes well to you. I have this problem. Would you please give me
your solution?
I want to change a property that I define on my user control in my web form
that contains...
|
by: |
last post by:
Hi,
I am setting the NumericUpDown .Value property and the ValueChanged event
is NOT being fired. Does this ONLY get fired when I change it on the UI and
not programatically?
Thanks
|
by: MLH |
last post by:
A form named frmVehicleEntryForm has a number of textbox
controls who's OnGotFocus property setting is an expression...
=Change2Green()
Change2Green() looks something like this...
Dim MyControl...
|
by: uiranejeb |
last post by:
Hi everybody,
I have a control that is dragged on a form. Let's say that we have a textbox control named txt1. I want to dynamiclly set a property of this control. I know the name of the control at...
|
by: Peter Krikelis |
last post by:
Hi All,
I am having a problem setting up input mode for serial
communications.
(Sorry about the long code post).
The following code is what I use to set up my comm port.
|
by: Patrick |
last post by:
I am dynamically creating TextArea and drop-down lists in ASP.NET using
something like HtmlTextArea eachTextArea = new HtmlTextArea();
I tried to set the "name" of these TextAreas, etc. (e.g....
|
by: Marty McFly |
last post by:
Hello,
I have a control class that inherits from System.Web.UI.WebControls.Button.
When I drag this control from the "My User Controls" tab in the toolbox onto
the form, I want it to reflect the...
|
by: Mark Rae |
last post by:
Hi,
Just a general quickie on setting properties of user controls from the
parent form.
Let's say I have a user control called note.ascx which displays a datagrid.
That datagrid is populated...
|
by: Academic |
last post by:
What are the different effects of the following two statements:
C1.Cursor = Cursors.WaitCursor
C1.Cursor.Current = Cursors.WaitCursor
I believe the first replaces the entire C1.Cursor...
|
by: Rob |
last post by:
Let's say you open Form1 that contains TabControl1
There are several tabs on TabControl1
Now you open a new Form2 that contains a User Control
How can you determine the Selected tab in Form1...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |