|
A parent form is a form which is a MdiContainer. A child form can call its parent using childfrom.MdiParent.
==== Lei Ming 2004 =====
====================
|
|
|
|
|
Yes but the methods of the parent form are not shown using childform.MdiParent
What if i'm not using an MDI container?
|
|
|
|
|
You need to cast it the concrete class. i.e.
MyMainForm frm = Parent as MyMainForm;
60% of statistics are made up on the spot
|
|
|
|
|
Still not getting it.
This is my code:
In the MainForm (GameForm)...
BuyingForm f = new BuyingForm(new_item); //new instance of a "child" form
GameForm gameForm = Parent as GameForm;
f.Parent = gameForm;
f.Show();
In the ChildForm (BuyingForm)...
this.ParentForm.SomeMethod(); //the method is not listed
|
|
|
|
|
Setup a field on your BuyingForm that holds a Form:
public class BuyingForm : Form
Form myParent;
.
.
.
myParent.PublicMethodCall( parameters );
When you create an instance of this form, just set this field before you show the form:
BuyingForm f = new BuyingForm(new_item);
f.myParent = this;
f.Show();
If you use the Parent property of the form to do this, you could have some very strange and unintended side effects.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What would be the safest way to do this? To avoid the strange unintended side effect.
|
|
|
|
|
If you look at my previous post, you don't have to worry about it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Changed the code but i still cant access any user made methods in my parent form, and yes they are declared as public. All i can see is the usual methods, events and properties of a form. Sorry to be a drag but whats going on?
|
|
|
|
|
ok finally got it working, thanks for your help!
|
|
|
|
|
hi, I'm making a simple download application. How do I get information about the file before I download it such as its size and name (without all the http information and such)? Also, in many download managers there is the option to download the rest of the file later, how is this done, I'm not asking for the rediculous amount of code it would take, but could you point me in the right direction? Thanks,
Stephen
|
|
|
|
|
Well, it is all done using the HTTP headers. One tells you the Content-Length,
other tells you the Content-Type, etc. And wneh you make an HTTP request, using
another HTTP header (don't remember the exact name) you can tell the offset
from which you want to receive tha data. That's it. Just find e good HTTP reference
and you'll be OK.
Cheers
|
|
|
|
|
|
Using C#, there's FileInfo class that can be instanciated. It gives all the informaion of a file, including size and date created, ect. For the download resume, there is a code at http://www.csharphelp.com/archives/archive9.html[^] that would give some insight of how to do it.
==== Lei Ming 2004 =====
====================
|
|
|
|
|
After much travail, I've finally got my ASP.NET project referencing all of its components when they're stored in the GAC - with one exception. For some reason, the compiler cannot find the "MyApplication.DLL", into which all of the Code-Behind assemblies are compiled.
I've verified that this file is strong-named properly, and the entry into the web.config file is identical to all of the others. A couple of hours worth of research hasn't turned up any reason why this file might be different from other DLLs, but I was hoping someone might have a suggestion.
Any help is greatly appreciated.
|
|
|
|
|
I'm stuck.
I'm writing a custom drawn ListView and I need to draw the subitems
of each item. So the cleanest way to get the subitem bounds is to send
an LVM_GETSUBITEMRECT message. But it works well only for indexes greater than 0.
This is also noted in MSDN. The big trouble comes when the columns are reordered
by the user. No matter what, LVM_GETSUBITEMRECT for index 0 always returns the bounds,
as if it was the leftmost column. For all other indexes LVM_GETSUBITEMRECT always
works fine in every case. How should I get the proper bounds for subitems at index 0?
|
|
|
|
|
Hello,
I am very much new to C# programming. The problem is I am
facing 'SEHException' using ShowDialog() method of Form Class.
I am using a form as Dialog from a MDIChild Form. I don't know why
it is happenging. But there is no problem if i use 'ShowDialog()'
from a non MDIChild form. How can i use the method from a MDIChild
form ?
sorry for my english.
thanks in advance.
|
|
|
|
|
You don't! MDI Children are not meant to be used a modal dialogs! Use a normal form if your putting up a modal dialog.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
A process that I have no control over creates a file that contains multiple XML declarations. Thinking I have to open file and remove all but first declaration and save to be able to read XML.
Do I need to do this, or is there another way to deal with multiple XML declarations in same file?
If I need to open file and manually remove, please help with how I may implement this.
Thank you.
|
|
|
|
|
You can read the file as a regular text file yourself, divide the text into the different xml declarations, and feed one of them or all of them into xml documents using the LoadXml method.
---
b { font-weight: normal; }
|
|
|
|
|
This code doesn't seam to work, it opens both as planned, but the frmCreate opens for 1/4 second or so, help please.
The code:
private void mnuLogin_Click(object sender, System.EventArgs e)<br />
{<br />
Form openform = new frmCreate();<br />
this.Close();<br />
openform.Show();<br />
}
|
|
|
|
|
Of course it does! You closed the form (this) that is the only thing holding a reference to the new form you created. If Form1 creates Form2 and show it, then Form1 closes, Form2 is going to close it since nothing else is holding a reference to Form2.
You can't "transfer" control of your application from form to form to form. You have to have a "parent" form that creates your other forms to keep their references alive. Those "child" forms can have their own "child" forms, and so on down the line. It'll look like a hierarchy when your done.
Startup Form
|
+-------+-------+
| |
Form2 Form3
|
+----+----+
| |
Form4 Form5
In this example, if you Close Form2, Forms4 and 5 are going to vanish too, because Form2 created and was holding the references for 4 and 5. In your code, you did just that. Your (this) form created a new form object called frmCreate, then killed itself, taking the newly created form with it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How do I HIDE the form or something so frmCreate can be seen?
|
|
|
|
|
try the opacity property
its me =Þ
grim zax
|
|
|
|
|
You don't look through the Intellisense list much, do you? You just said it yourself -> this.Hide()[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I said that as I found it in the list lol.
|
|
|
|