|
Hi folks!
I will ask very simple question.Unfortunately I still could not understand the reason.
Suppose that you have a master-detail forms based application.When I open the detail form of the application I use the new keyword to create a new instance..It's ok...But when I try to access the Master form properties(for example Form1's textbox1) WHY DO I HAVE TO CREATE A NEW INSTANCEOF FORM1.Behind the scene it is already open..Right???
Please tell me something about this...
THANKS FOR ALL!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
Hi!
I don't know exactly what code you refer to but when you have two form instances, each instance has at some time been created using new.
If you try to access the properties of one form from the other one you have to have a reference to the other form.
If you don't have the reference, you can't access the properties, simple as that.
If you're trying to create a new instance in order to access some properties you're likely to access the properties of the wrong object.
mav
P.S.: "Multiple exclamation marks, are a sure sign of a diseased mind" (Terry Pratchett, Reaper Man)
|
|
|
|
|
ok, let me see if understand you... You have two (or more forms but lets just take two) forms one being the parent of the other (Master-Detail ?)
You want to open the child form and access the properties of the parent form from within the child form ?
Much like mav said just create a reference to the parent form....
public System.Windows.Form ParentForm=null;
ChildForm CF = new ChildForm();
CF.ParentForm=this;
CF.Show();
now you should be able to access all internal/public props and methods of your parent form from you child form.
NOTE: I did not test the above code, I just typed it....
|
|
|
|
|
The simplest way I can explain my problem is this.
I have several forms each containing a task specific user control. Now only one form has it's ShowInTaskbar property set to true the rest are set to false. All the resize and movement event handlers work so when one form is moved the whole collection of forms move with it as one unit. The problem I'm having is when I say click on the taskbar to check my code in VS and it covers the forms as it's running then click back on my program in the taskbar only the the form with it's ShowInTaskbar property set to true pops up. The rest stays behind. All I'm looking for is what event is raised when the user clicks on an inactive (or minimized) program on the taskbar and the quickest way to redraw all the other forms after the event handler fires.
Thanks ahead a time for the help
Ryan
|
|
|
|
|
I don't exactly now how you would do it in C#, but when you get the SizeChanging event for the form that will be active, bring the other forms to top. With the Win32 API, you would use SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE) to bring the window to the top of the Z-order.
Maybe you'll have to use P/Invoke, or you could set the focus to every window and then to the one being restored, but that would show some flicker.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
This Article shows how to get events for changing window states.
For the other one I would just loop thorugh the forms and set the windowstate to normal (dunno if its fast).
|
|
|
|
|
Well you could override the Activated event on your main form.
I assume you have the other forms in an array or something..
try this...
private void Form1_Activated(object sender, System.EventArgs e)
{
foreach(System.Windows.Forms.Form MyForm in FormArray)
MyForm.Activate();
}
|
|
|
|
|
ok i got it working nicely but i noticed something that maybe someone can tell me how to prevent or if i can prevent it at all. when i trap the WM_ACTIVATE message and activate each child form then activate the main form the window caption blanks out as soon as i select another program or click out of the main form the captions are back. it's not that big of a deal the main problem is fixed i'm just curious
thanks for your help
Ryan
|
|
|
|
|
Hi, All,
int a = Convert.ToInt32("1234"); // it works fine, result a = 1234.
int a = Convert.ToInt32("0x10");// fails, it does not recognise "0x"
My question is how do I convert "0x10" to integer 16.
I struggle on this for 4 hours in vain.
Thank you for your help.
|
|
|
|
|
Let me anwser myself.
int a = Convert.ToInt32("0x20", 16); // then a = 32;
|
|
|
|
|
Because the string "0x10" used by you is in hexadecimal form which uses the fromBase value of 16 in the following method,
public static int ToInt32(string value, int fromBase);
Therefore, you have to use the aforesaid overloaded method with the value of the second parameter fromBase being put at 16, in which case a string containing a hexadecimal number can be correctly converted to a mumber in int format.
For illustration, the example in your question,
int a = Convert.ToInt32("0x10");//does not work
will not work and will have to be used in the following form,
int a = Convert.ToInt32("0x10", 16);
in which case "a" will have the value of 16.
Similarly in,
int a = Convert.ToInt32("0x30", 16);
"a" will have the value of 48.
|
|
|
|
|
Hey,
my problem:
i hava a typed dataset with 4 tables. I want to display one of the tables in a datagrid, but i don't want to display the "+"-sign to show the child rows
how can i prevent the datagrid from showing the datarelations?
greetz
|
|
|
|
|
|
I am trying to generate proxies using wsdl.exe (Web Services Description Language Utility) tool. When I look into the proxy code (C#), there is no code for the <group> tags from wsdl file.
This .wsdl file provided by another group.
Is the WSDL.exe utility won't support the <group> tags or something is missing the .wsdl file?
ex: (snippets)
<complexType name="Address">
<annotation>
<documentation>complete address.</documentation>
</annotation>
<choice>
<group ref="base:ForeignAddress"/>
<group ref="base:USAddress"/>
</choice>
</complexType>
..
...
<group name="USAddress">
<annotation>
<documentation>US address</documentation>
</annotation>
<sequence>
<element name="addressLine" type="base:AddressLine" maxOccurs="6"/>
<element name="city" type="base:USCity"/>
<element name="state" type="base:State"/>
<element name="zipCode" type="base:USPostalCode"/>
</sequence>
</group>
The generated class:
public class Address {
/// <remarks/>
public object Item;
}
Thanks in advance.
|
|
|
|
|
Is it possible to expose a particular instance of an object via .NET remoting? I've read that Marshal will put the object forward, but how do you connect a client to that object?
DC
|
|
|
|
|
who is Marshal ??
.... From russia with love ....
|
|
|
|
|
|
Alright, I've figured it out. You create an object, initialize it, then expose it using RemotingServices.Marshal. Too cool.
DC
|
|
|
|
|
I want to create an interface in Arabic / Urdu language in VB.Net / C#.
If if have an example, please send me to my mail address jawwad.farook@gmail.com.
I shall be thankful
|
|
|
|
|
Everything you need is in the System.Globalization namespace. You can use resource files to hold culture-specific variations of text strings and display them based on the target language.
Plenty of examples online if you search for them.
|
|
|
|
|
how to handle sql errors with severity less then 10 in C#
.... From russia with love ....
|
|
|
|
|
try
{
...
}
catch(SqlException ex)
{
...
}
finally
{
...
}
|
|
|
|
|
when severity less then 10 it's an information message, so it's SqlError, and in not exists in SqlException i tried what u wrote and on error i don't go to catch block.
.... From russia with love ....
|
|
|
|
|
|
I have a 3 tier (biz data and gui layers) web app.
Should I be destroying the BLL or DAL objects after I am none using them?
How come w3wp.exe on the server keeps growing as people use the web app?
Does the fact that none is destroying the objects when they use them have anything to do with it?
We recently moved to the QC box and I am very concerned with the mem usage of w3wp.exe going up as I am testing the site. I am the only user.
Thank you in advance for any advice.
Paixtis
|
|
|
|