|
Hi,
I tried to reproduce the error that you are referring here, but couldn't reproduce it.
The MDI parent form's closing event is not firing because you are calling Application.Exit() in the Child form, which closes the entire epplication.
May be some other code you have is creating the error.
Blumen
I wish to become a software consultant.
|
|
|
|
|
Hi to All,
My English is not native, sorry.
Ok, I have MDI form and Child form.
in the MDI code file I added "Form_Closing" event.
private void frmMainMdi_FormClosing(object sender, FormClosingEventArgs e)
{
// Hold the MessageBox button pressed
DialogResult diaResult;
// Show Message to the User
diaResult = MessageBox.Show("Are you sure you want to cancel the setup?",
"Exit Setup",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning,
MessageBoxDefaultButton.Button2);
// Checking which button as been pressed
if (diaResult == DialogResult.No)
{
// CANCEL pressed, set focus to the program
e.Cancel = true;
}
else
{
// YES pressed, exit the program
this.Dispose();
Application.Exit();
}
}
Now, In the child form I have CANCEL button that suppose to close the application if the user press "YES".
I added to the cancel button click event:
Applicarion.exit();
and then I am having an error.
How can I close the program from the child form using the Form_Closing event from the MDI form.
Thanks
VBDC
|
|
|
|
|
I have to implement A peer-to-peer text messaging application . the idea is as follows.
Please has anyone designed a similar application ! i would be very greatful if u can help ?
In a client- server paradigm clients never communicate directly with each other. This often leads to the centralisation of user interaction. The peer-to-peer (p2p) model tried to overcome this problem. In a p2p model, users cannot communicate directly with each other. It may be helpful to view a ‘peer process’ as an entity incorporating a client and a server within it.
A peer process typically uses a central server, a peer-directory, to find out about other peer processes in the system. Peer-directory maintains a table whereby the address and port number of a peer is mapped on to a single integer index. Peers identify each other by this index number. We will refer to this index number a peer-id.
The central server or the peer-directory provides a mechanism whereby peers can coordinate their interaction in time and pace. However, the rest of the interaction can then be conducted directly, without the need for the central server. In this way, significant reduction of centralized communication can be achieved and a more distributed pattern of network usage is created. In a peer-to-peer text system the central server maintains a table where information on member is stored. Whenever a new member subscribes into the system, the central server sends the updated table to all members of the group. Peers send text messages directly to each other.
Centre peer. The interaction between peer and peer directory can be organized in such a way that peers are automatically notified whenever a new member enters or exit the peer group.
|
|
|
|
|
This reads like a homework assignment. What bits are you stuck with ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
just the basic idea how to put into design ! files i have to create, and actual implementation
Have you done any kind of application similiar to this one ?
thanks
|
|
|
|
|
This seems like an exam question..
You can use socket communication for this purpose. There are lots of articles in CP related to this.
I wish to become a software consultant.
|
|
|
|
|
http://www.centrumxp.pl/dotNet/831,1,Komunikator_w_C.aspx
- it's in polish but hope it helps
life is study!!!
|
|
|
|
|
is there a way to set up multiple audio cards to play multiple sources separate, and together? for example, i want to set up a whole home audio system using a single computer. i want to use 3 sound cards and be able to play 3 separate audio sources to separate rooms from the single box, and if i want, combine the sound sources to play throughout the house simultaneously. is there a way to do this?
|
|
|
|
|
What does this have to do with C#? And in response to your connections yes I would think this is possible.
|
|
|
|
|
uhhh, i'd like to know how to accomplish it with c# programming? if it's possible?
i'd like to create an app that can take advantage of this, but i don't know the how to do it
-- modified at 20:28 Tuesday 8th May, 2007
|
|
|
|
|
A simple Google search would have resulted in this[^] article.
|
|
|
|
|
This may be lower level than what you're looking for, but you can use the managed version[^] of DirectSound to send waveform data to your soundcards.
|
|
|
|
|
Hi,
Can any one tell me, how to copy the tables from one database to another? and how to create database in MySQL at runtime?.
Gopal.S
|
|
|
|
|
Gopal.S wrote: how to create database in MySQL at runtime
A quick web search brings up this result[^].
|
|
|
|
|
I am coding a "Trace" object. This object will report the "method name" of the method within the class that the code is currently executing. I do not want to have to type in the method name each time the trace object is called. I simply want to determine tha nem of the method call that is currently being excecuted. How Can I accomplish this?
"Moose Man"
|
|
|
|
|
Doing a stack walk is not the fastest thing on Earth, but you could use the System.Diagnostics.StackTrace class for that.
|
|
|
|
|
Please don't repost questions so soon after you have asked it originally. You asked this question once today already - give people a chance to answer before you do it again. It's only polite.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I want to invoke DsmSetLoadBalancePolicy through WMI; whatever I try, it gives me in valid parameters.
Could someone please help me here.
Regards,
DJ.
|
|
|
|
|
Just to add to it, I am using C# (may be its obvious ).
|
|
|
|
|
Show us how you're trying it. Also, have you looked at the System.Management.dll included in the .NET framework?
|
|
|
|
|
I am already using System.Management
This is what I am doing.
- Read the current load balance policy of the lun we are interested in
- create new ManagementBaseObject from this object
- Use this close as parameter to the invoke method.
I think creating a clone may not be a good diea but I am not sure how to create a ManagementBaseObject of a specific class type.
Following is the code snippet for your reference.
int ChangeLoadBalancePolicy(string szLunName, uint uiLbPolicy, List<ulong> lu64PathIds)
{
try
{
string szScope = "\\\\localhost\\root\\WMI";
ManagementClass deviceInfo = new ManagementClass( szScope,
"MYDSM_QueryLBPolicy",
null);
ManagementObjectCollection deviceCollection = deviceInfo.GetInstances();
ManagementBaseObject policyObj;
// Get the LB Policies for each device
// and for each device create associated DSM Path objects
foreach (ManagementObject device in deviceCollection)
{
string szInstanceName = device["InstanceName"].ToString();
// if found the instance
if (szInstanceName.Equals(szLunName))
{
ManagementBaseObject lbPolicy = (ManagementBaseObject)device["LoadBalancePolicy"];
policyObj = (ManagementBaseObject)lbPolicy.Clone();
ManagementBaseObject[] dsmPathList = (ManagementBaseObject[])lbPolicy["DSM_Paths"];
ManagementBaseObject[] inDsmPath;
inDsmPath = new ManagementBaseObject[dsmPathList.Length];
int i = 0;
// For each Path, get the adapter info, which has the path info
foreach (ManagementBaseObject dsmPath in dsmPathList)
{
//ManagementBaseObject mPath;
inDsmPath[i] = (ManagementBaseObject)dsmPath.Clone();
inDsmPath[i]["DsmPathId"] = (ulong)dsmPath["DsmPathId"];
inDsmPath[i]["Reserved"] = 1;
inDsmPath[i]["PathWeight"] = 0;
bPathSelected = false;
// If DSM path id is slected as a part of the change policy request
// mark it as primary path.
foreach (ulong u64PathId in lu64PathIds)
if (u64PathId.Equals((ulong)dsmPath["DsmPathId"]))
{
dsmPath.SetPropertyValue("PrimaryPath", 1);
inDsmPath[i]["PrimaryPath"] = 1;
bPathSelected = true;
m_Log.WriteEntry(dsmPath["DsmPathId"].ToString() + " is selected");
}
if (!bPathSelected)
{
dsmPath.SetPropertyValue("PrimaryPath", 0);
m_Log.WriteEntry(dsmPath["DsmPathId"].ToString() + " not selected");
inDsmPath[i]["PrimaryPath"] = 0;
}
i++;
}
// Preparing the in parameter
policyObj["LoadBalancePolicy"] = uiLbPolicy;
policyObj["Version"] = 1;
policyObj["Reserved"] = 1;
policyObj["DSMPathCount"] = inDsmPath.Length;
policyObj["DSM_Paths"] = inDsmPath;
ManagementClass policyInfo = new ManagementClass(szScope, "MYDSM_SetLBPolicy", null);
ManagementObjectCollection lunCollection = policyInfo.GetInstances();
foreach (ManagementObject lun in lunCollection)
{
if (szLunName.Equals(lun["InstanceName"].ToString()))
{
// Method Options
InvokeMethodOptions methodOptions = new InvokeMethodOptions();
methodOptions.Timeout = TimeSpan.FromMinutes(1);
ManagementBaseObject tinParams = lun.GetMethodParameters("DsmSetLoadBalancePolicy");
tinParams["LoadBalancePolicy"] = (ManagementBaseObject)policyObj;
ManagementBaseObject outParams = lun.InvokeMethod("DsmSetLoadBalancePolicy", tinParams, methodOptions);
return (int)outParams["returnValue"];
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
|
|
|
|
|
OKAY!.
Finally the problem solved and lesson learned.
What I was doing is sending a "ManagementBaseObject" object as in parameter but the InvokeMethod expects it to be a "object" type.
So I copied the "ManagementBaseObject policyObj" into a "object tempObj" by
tempObj = policyObj.Clone();
And now instead of doing,
tinParams["LoadBalancePolicy"] = (ManagementBaseObject)policyObj;
I did,
tinParams["LoadBalancePolicy"] = checkObj;
This works fine.
Regards,
DJ.
|
|
|
|
|
Greets all
Can anyone tell me how to apply the SeDenyInteractiveLogonRight right to an account in C#, preferably using the DirectoryEntry class?
Thanks
ccitt
|
|
|
|
|
Hi every one,
I have some questions in c# and i'd appreciate any help with this concern.
1)I can't find the splash screen option in the properties of the project and i could'nt add it from add new item dialog box, so how can i add a splash screen??
2)I need to have a database (ms access) in my application, how can i create the setup for my application that includes the database and other resources such as some .swf files??
3) can i convert an image (say .jpeg) to an icon (.ico) using the Icon class?? How??
Thanks in advance to all..
|
|
|
|
|
r_jaz wrote: 1)I can't find the splash screen option in the properties of the project and i could'nt add it from add new item dialog box, so how can i add a splash screen??
In C#, you have to create a splash screen out of a form, then call it as the startup form.
r_jaz wrote: 3) can i convert an image (say .jpeg) to an icon (.ico) using the Icon class?? How??
Just use a bitmap and save it in an icon format, like so:
Bitmap bmp;
bmp = new Bitmap(@"C:\Image.png");
bmp.Save(@"C:\Icon.ico", System.Drawing.Imaging.ImageFormat.Bmp);
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|