|
Hi
I have simply created a form in vs2003.
Then i added another form to the project.
when the first form load it starts the other form like this
private void OnLoad(object sender, System.EventArgs e)
{
Form2 fm2 = new Form2();
fm2.Show();
}
But then the I want to get notified when Form2 close,
and i cannot use the ShowDialog(), I simply use
this.close(); to close Form2.
Can someone help me how to get notifed when Form2 close?
Thanks
QzRz
|
|
|
|
|
Try to come up with a subject that is a little more specific. Every question in this forum is a C# questions...
Make an event handler and add it to the Closing or Closed event of the second form.
---
b { font-weight: normal; }
|
|
|
|
|
QzRz wrote: Can someone help me how to get notifed when Form2 close?
Just wire up one of the existing Form events. Wire up Closed if you only care that the form has gone away, or Closing if you want to prevent the close from occuring for some reason:
Form2 fm2 = new Form2();
fm2.Closing += new CancelEventHandler(fm2_Closing);
fm2.Show();
private void fm2_Closing(object sender, CancelEventArgs e) {
}
Share and enjoy.
Sean
|
|
|
|
|
In the mainform (the first form) i have a few events
it has to run through when it close.
So it is in the first form I want to be notified when
form2 close.
I have tried to make the stuff in the first form to
public, but that does not make them to be thrown from Form2.
|
|
|
|
|
QzRz wrote: In the mainform (the first form) i have a few events
it has to run through when it close.
So it is in the first form I want to be notified when
form2 close.
Right, I understood that. The code in my earlier message goes into your "form1", we'll call it.
You have some event in form1 that causes form2 to be displayed (a button click, or a menu selection, or something). That action happens and form2 is created, the Closing event is wired to an event handler in form1 and finally form2 is displayed. The creation of form2, its event wiring and event handling code are all in form1.
When your user closes form2, by invoking a Hide() method, or setting form2.Visible = false , or by clicking on the Windows close button at the top right of the form, the fm2_Closing event handler in form1 will be invoked.
You can do whatever you need to do with the data collected by form2 in that event handler (probably some sort of data validation).
Dig? Share and enjoy.
Sean
|
|
|
|
|
Yes, that did it
I did not know you could do this.
I appreciate you help
Thanks
|
|
|
|
|
Hi:
I am using COM Interop to transfer an array of doubles from Excel to C#. The only way I could find to do this from a google search was to have the data passed to an object. (see code below)
I am unable to cast the generic object into a double[]. In debug mode in C# I can single step into the method and see that dataObject has the elements in it, but I cant find a way to access the elements. Please could you tell me how I can access the elements of the vector?
VBA:
myInterface.CallMethod(doubleVector)
C#:
public int CallMethod(object dataObject)
{
double[] thisArray = (double[]) dataObject; // does not work: says invalid cast
}
Regards, Sam
|
|
|
|
|
What does dataObject.GetType() report the type as?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
I placed this in the method:
Type thisType = dbArray.GetType();
and in debug mode I can inspect thisType as:
{"System.Double[*]"}
Regards, Sam
|
|
|
|
|
Hmm. That stumps me; if the runtime says its a double[], you should be able to cast it unless something's wrong. Maybe you should post in the Tools For Office[^] forum.
|
|
|
|
|
I found the way to do this and have posted an article on this subject:
http://www.codeproject.com/useritems/arraysVBAToCssv1.asp
Regards, Sam
|
|
|
|
|
Hi
I am using crystal report for the first time. I have CrystalReport1.rpt with the name of table and datafields all set. Can anyone tell me how do I display the results after filtering it with a particular field value programatically. I am programming in C#.
Thanks
|
|
|
|
|
After reading thru about 12 pages of postings, and articles on wmi I found nothing explicitly describing or addressing my problem, so here is my question:::
I am Trying to retrieve the serial number from my monitors, I have verified by use of other software tools that this number does infact exist within the PnP data, and **should** be accessible by use of wmi/cim. However every time I have tried to access this information I am restricted to accessing only what the OS says I have, which is *default monitor*. Now as I stated, I have already used another tool to retireive this info, so I know the possiblity exists, so just short of calling a few "friends" over to rough up the devies who created it I'm on the hunt for my own solution. But like I said, the only thing I can find is the *default monitor* from the OS.
I did pursue an attempt with the registry data, but kinda got side-tracked once I encountered the EDID entries being in binary (didn't have the mental capacity that day to try to do conversions), so I left it alone for a few days.
and without trying to spend too much time looking into MIF / DMI I found that that may provide some useful information, but I haven't researched that too much yet.
Now I'm back working on it, and i need to find a way to access this information.
so just short of reading the entire DMI standard just wondering if anyone out there has used any thing that has worked for them or any tips on where / how to find this information (besides turning the monitor around and writing it down. )
Oh, yah, we are using Dell devices, so I know Dell has proprietary software for this, but that isn't an option for us.
thanks in advance
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
Hai all,
I would like to know if there is away to dock the MainMenu anywhere other than the standard top docking. As soon I drag and drop onto the designer it is docked to the top of the form. what should I be doing if I need to have the menubar docked below a toolbar for example?
( toolbar or a panel on the top and the menubar below it)
Any ideas would be greatly appreciated.
Thanks,
VPMahank
|
|
|
|
|
You'll need a 3rd party control to do that. Search the articles here, I know there're docking toolbars available, but haven't looked for a menus specifically.
|
|
|
|
|
I believe you can do this using a ToolStrip (.NET 2.0) combined with a ToolStripContainer (.NET 2.0).
|
|
|
|
|
Could you please elaborate a little bit on how to approach the problem?
Thanks,
VPMahank
|
|
|
|
|
Sure. Place a ToolStripContainer on your form. Place a ToolStrip on the top. It will now be movable to whatever borders of the form you've chosen in the ToolStripContainer settings.
|
|
|
|
|
Hi! I need a little help!
Is there any chance to make a shaped form!? I mean not just transparent in some parts of the form, but when i click on the transparent part of the form, i want the form to lose the focus! I`m also interesting is there any chance to make a shaped button, not the rectangle button with an image of that shape! Because, in this solution, when you click in some corner of the rectangle, where the picture is transparent, and the user think that there is no button, he can still click on it! I want a shape (circle, for example), so user can click on the button only when the cursor is in the circle! And only one more question! Is there any chance to make a button with one image, but when the mouse enter the button, mouse image goes to the moving giff image!? Thanks a lot!
|
|
|
|
|
Provo kete
www.java2s.com/Code/CSharp/2D-Graphics/Shapes.htm
|
|
|
|
|
|
|
I'm curious if anyone has found a way arround it. I've got a dll built with the beta of c# VS.Net 2005. I want to add that dll as a reference in a vs.net 2003 project but i get the classic "could not be added. this is not a valid assembly or COM component. only assemblies with extension 'dll' and COM components
can be references. Please make sure that the file is accessible, and
that it is a valid assembly or COM component." error.
anyone found a way arround this, or am i trying to do the impossible?
|
|
|
|
|
There's a good chance you're trying to do the impossible, since the 2005/.NET 2.0 dll may have references to or exposes 2.0-specific functionality (such as generics) which are not supported in 2003/.NET 1.1.
|
|
|
|
|
The problem is even more straight forward than that. Because 2.0 introduced such items as generics it required the Metadata format to be updated. This new format is not backwards compatible with 1.0 and 1.1. Such the 1.x versions of the frameworks cannot load your 2.0 dll irrespective of what type of code you actually wrote in the dll.
However it is possible fon a 2.0 DLL/APP to reference a 1.x DLL
Jared Parsons
jaredp@beanseed.org
http://spaces.msn.com/members/jaredp/
|
|
|
|