|
Thanks for the reply
I would like to enable the Apply button in the main form as soon as I change the status of any control in the Option form. e.g. I have a check box in the Option form, if I click it and change the status from checked to unchecked or the other way, I would like to enable the Apply button in mail form so that is I click it, I will do some other processing of storing the status of the controls.
Sorry for not being acurate in stating the problem.
regards
|
|
|
|
|
hi,
Use little logic to achive that using my old post
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
You are going to have some limitations to doing this. Both forms must be in the same message thread (so your first form must launch the second form on the same thread).
To access data in a partner form you need to do a few things.
Situation : You have Form A. It will create Form B. Form B must change status in Form A.
Answer: Modify your constructor in Form B to take its' parent as a parameter. Then in Form A pass (this) in the creation logic.
If it is the reverse (Form A creates and modifies Form B) no special constructor is needed since you already have the form object at your disposal.
Now the second part of it: accessing the button, label, whatever. To follow proper coding convention, you would add an accessor to the form for each field you want to expose access. Your accessor would provide both a getter and setter.
One other approach is to implement an event bubbler. Tie each form together with your own event much like the Observer Pattern. Then when a change needs to occur, the observer raises the event, which can bubble up through the various forms, and each form can react to the event accordingly.
If your forms are in different application domains, then you would probably want some type of remote notification system (much more complex).
This signature left intentionally blank
|
|
|
|
|
thank you very much for the comprehensive reply.
my forms fit in first situation, they are in one thread only. in the main form i have Option button, on its click event Option form is created.
let me explain a bit more about what am i up to.
the main form is customized Print dialog, its upper half is like a normal print dialog and lower half is divided in two parts, left part is having a tree view and right part is kept for displaying user controls associated with the three node, each one is linked with the tag property of the tree view node. thus i have near about 115 controls ( check boxes, radio buttons, numeric up-down controls and combo boxes ). besides a few more in option form.
i have an Apply button to save the status of all controls. its normally in disable state and have to make it enable as soon as any controls status is changed, and have to again disable the Apply button is the user comes back to earlier status. how to keep track of all the controls is the big question for me. besides the earlier problem.
i was also thinking of passing 'this' in the constructor of Option form, but i read some where that parameterized form constructors are not advisable, thats why i wanted to have experts comments.
i understood the concept of getter-setter in your reply but being a new comer not able to understand the concept of an event bubbler. please explain it a bit more.
regards
|
|
|
|
|
Okay -- here is an example of a bubble-up architecture:
I have a control which contains a treenode and a display area.
The 'display area' will have different custom controls loaded based on the type of data selected in the tree. This control can exist in the main form or can exist as a dialog by itself in your applications.
The parent form that contains this control has the job of opening the file. This event is exposed for anyone interested. It loads a custom control which can have access to the NewFileEvent from the parent form. This second custom control lets the user select filters from dropdown boxes. It raises the NewFilterEvent to its children and the NewFileEvent. So it has code like this:
parent.NewFileEvent += new NewFileHandler(NewFileBubbler);
...
private void NewFileHandler(object sender, NewFileArgs e)
{
if (this.NewFileEvent != null)
NewFileEvent(sender, e);
}
Each subsequent control that gets loaded may contain hundreds of controls but they pick and choose which events they are interested in. That initial control I spoke of wants to know when a new file is loaded and when a new filter is set. If you write a program that uses my control, you need to provide your own events using my defined event arguements to pass the new data, new file location, new filters, whatever.
The end result is the parent has no idea what is loaded in it. The control it loads loads other controls which load their controls, which load their controls. Events bubble up from the parent to the top-most control.
This handles a situation where you want all of the controls in the list to know that a state has changed. It sounds, though, like you want the reverse. You want to know when one of the controls changes. This sounds like you may want the Observer Pattern. It has an observer that acts as a go-between between the data (control state) and the observers (the items that have to react to that change).
Start here[^] to find out about the Observer Pattern and see if that helps your situation.
This signature left intentionally blank
|
|
|
|
|
it was really valuable indeed. thanks is a small word for that.
regards
|
|
|
|
|
What is required for Black-n-White Invert before printing ( or previewing) any picture?
How to do it programatically?
please guide.
|
|
|
|
|
|
Hello Mr Mark
Thanks for the help, but what i am up to is , to change only balck to white or white to balck, rest of the colour should remain as it is. where as the referred link's sample changes other color too.
regards
|
|
|
|
|
Just wondering how to hide a property of an interface in a sub-class?
For example in .net framework,
OracleCommand implements IDbCommand, but OracleCommand doesn't have the CommandTimeout property where IDbCommand has.
IDbCommand has<br />
int CommandTimeout {get; set;}<br />
<br />
<br />
public class OracleCommand : IDbCommand<br />
try using OracleCommand.CommandTimeout gives an compile error.
How???
|
|
|
|
|
You must cast OracleCommand to IDbCommand.
Hide interface property you can do in this way
public class MyCommand : IDbCommand
{
...
int IDbCommand.CommandTimeout
{
get
{
...
}
set
{
....
}
}
}
vlado
|
|
|
|
|
Server Error in '/log_on' Application.<br />
--------------------------------------------------------------------------------<br />
<br />
Syntax error: Missing operand after '@yuy' operator. <br />
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br />
<br />
Exception Details: System.Data.SyntaxErrorException: Syntax error: Missing operand after '@yuy' operator.<br />
<br />
Source Error: <br />
<br />
<br />
Line 89:
Line 90: <br />
Line 91: DataRow[] matches = users.Select(cmd);<br />
Line 92: <br />
Line 93: <br />
<br />
<br />
Source File: c:\inetpub\wwwroot\log_on\logon.aspx.cs Line: 91 <br />
<br />
Stack Trace: <br />
<br />
<br />
[SyntaxErrorException: Syntax error: Missing operand after '@yuy' operator.]<br />
System.Data.ExpressionParser.Parse() +2753<br />
System.Data.DataExpression..ctor(String expression, DataTable table, Type type) +149<br />
System.Data.Select..ctor(DataTable table, String filterExpression, String sort, DataViewRowState recordStates) +76<br />
System.Data.DataTable.Select(String filterExpression) +37<br />
log_on.Logon.btnLogon_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\log_on\logon.aspx.cs:91<br />
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108<br />
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57<br />
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18<br />
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33<br />
System.Web.UI.Page.ProcessRequestMain() +1277<br />
<br />
<br />
<br />
<br />
--------------------------------------------------------------------------------<br />
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
I've ravaged through MSDN and the KB articles and I am still not sure what is the problem here. cmd is a string for a validated and well formed email address.
Thanks for any suggestions or help.
Best,
Jerry
Contrary to the cliche, genuinely nice guys most often finish first or very near it.--Malcolm Forbes Toasty0.com
|
|
|
|
|
|
private void btnLogon_Click(object sender, System.EventArgs e)<br />
{<br />
<br />
if (!Page.IsValid)<br />
{<br />
lblMsg.Text="Some required fields are invalid.";<br />
return;<br />
}<br />
else<br />
{<br />
string cmd=txtBoxEmail.Text;<br />
<br />
<br />
DataSet ds= new DataSet();<br />
<br />
<br />
FileStream fs= new FileStream(Server.MapPath("Users.xml"),FileMode.Open,FileAccess.Read);<br />
StreamReader reader= new StreamReader(fs);<br />
ds.ReadXml(reader);<br />
fs.Close();<br />
<br />
<br />
DataTable users= ds.Tables[0];<br />
<br />
<br />
DataRow[] matches= users.Select(cmd);
Thanks for looking at this.
Best,
Jerry
Contrary to the cliche, genuinely nice guys most often finish first or very near it.--Malcolm Forbes Toasty0.com
|
|
|
|
|
The '@' character might be causing you problems:
From the SQL Server Books Online:
SELECT @local_variable
Specifies that the given local variable (created using DECLARE @local_variable) should be set to the specified expression.
It is recommended that SET @local_variable be used for variable assignment rather than SELECT @local_variable. For more information, see SET @local_variable.
Syntax
SELECT { @local_variable = expression } [ ,...n ]
Arguments
@local_variable
Is a declared variable for which a value is to be assigned.
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
Would this also apply to a XML data file?
Best,
Jerry
Contrary to the cliche, genuinely nice guys most often finish first or very near it.--Malcolm Forbes Toasty0.com
|
|
|
|
|
Toasty0 wrote:
Would this also apply to a XML data file?
Oops. Somewhere I got the idea that this was an SQL statement.
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
Hi,
My application contains a Panel which in turn contains some more panels, that are added and removed at runtime. I draw some lines and strings also at runtime. Usually there will be many controls that do not fit into the visible area of the parent panel. So, I would like to implement zoom in and zoom out in that panel ( as we do in Flash pages ).
To best of my knowledge, normally zooming is implemented on images. How to implement on objects like panels ??
Thanks.
Cheers
CNU
|
|
|
|
|
AFAIK, the hard way--you have to do code all the functionality. There's no built in API stuff to do that.
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
I am not going to try to take credit here, and will just link to the article.
I thought it was funny how the Standard Edition would not let me make a windows controls library project, but it is fully possible in SharpDevelop using just the SDK compiler.
I did some googling, and this article came up.
http://www.devcity.net/net/article.aspx?alias=vbnet_se_dll
A great find, and I can finally make Dll user control libraries in the standard edition as well.
PS! although the article is for VB, I have testet it with C# myself, and it works great.
Enjoy!
HalfAsleep
|
|
|
|
|
You can make a Windows control library - there's just to project for it (a template of files and settings). Just start a regular class library and add a class that derives from a control. There's no difference other than the base classes from which your classes derive.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Ah, nice to get that confirmed. I was a bit miffed that the standard version did not have that project template.
If a normal class library template will do, and everything will work as long as you have classes that inherit from controls, that is good news indeed.
Thanks a bunch!!!
By the way, is there any way of adding your own project templates in the "new project" dialogue?
HalfAsleep
|
|
|
|
|
Explore your Visual C# installation directory. The default is C:\Program Files\Microsoft Visual Studio .NET 2003\VC#. There's several directories involved and it's really not too difficult to figure out, but I believe you might find some articles here on CodeProject and elsewhere on the 'net if you try a search.
There is one tutorial in the Visual Studio .NET Product Documentation, but it's targetted at the Enterprise Architect edition which include a project for making projects (it's fairly close to what you need, though).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Anyone know anything about reading the game port in C# ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Man, Chris, you write so much interop code and unsafe code (remembering your previous articles about graphic manipulation), you should just use C/C++, or at least switch to MC++!
Have you looked into Managed DirectX at all at http://msdn.microsoft.com/directx[^]. Much of this is encapsulated in a nice object-oriented fashion (and the Managed DirectX libraries are written from the ground-up, not simply interop libraries or 1-to-1 mappings of managed code like some libraries).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|