Thanks Jon for helping out. Yes it is a dialog box. But there are things
going on in the background and the size of the control that I need instead
of the regular message box. Here is the cut down version. From the sounds of
it. I will just have to stick to the regular way.
namespace HOST
{
public class Order_Zone : System.Windows.Forms.Form
{
//Returns User Response From The Pad_Password
private void PadPassword_Return(string Item_Info)
{
//If User Is Changing Table Ownership
if(Temp_Item == "EMPLOYEE TRANSFER")
{
MSG_YesNo MSGYesNo = new MSG_YesNo();
MSGYesNo.Location = new System.Drawing.Point(280, 30);
MSGYesNo.Show();
this.Controls.Add(MSGYesNo);
MSGYesNo.BringToFront();
**//I prefer not to take this route. But it does work prefectly
MSGYesNo.Item_Pass += new MSG_YesNo_Item_Pass(MSGYesNo_Return);
**//I would prefer to do something like this
string response = new MSG_YesNo_Item_Pass(MSGYesNo_Return);
if(response == "YES")
{
....Do Something
}
}
}
//Returns User Click From MSG_YesNo Control
private void MSGYesNo_Return(string Item_Info)
{
...Do Something
}
}
}
...Custom Control
namespace HOST
{
public delegate void MSG_YesNo_Item_Pass(string Item_Info);
public class MSG_YesNo : System.Windows.Forms.UserControl
{
public event MSG_YesNo_Item_Pass Item_Pass
***Both Yes No buttons events Handler
//Get User Response For Button Selection & PassBack info
private void On_Click(object sender, System.EventArgs e)
{
Button Button_Item = (Button)sender;
ItemPass(Button_Item.Text);
//Dispose of This Control
this.Dispose();
}
//Item Pass Back To Calling Function
protected virtual void ItemPass(string Item_Info)
{
Item_Pass(Item_Info);
}
}
}
Hopefully this is not too long coded and hopefully straight forward. Any and
all help is appreciated.
MikeY
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
On Jun 7, 3:46 pm, "MikeY" <mikesi...@yaho.comwrote:
>What I've done is to create a control that gets called from this form so
that when a user does an action, a pop-up "YES"/"NO" box appears
ontop of the form. For them to proceed with their action or not.
The previous code calls up and places this contol on my form.
And when the user selects their option the control gets disposed of
and the "YES" or "NO" gets passed back to this form. And all is good
up to this point. But I was looking for a way of keeping the passed
information within this method instead of having to pass the infor to
another method instead of ie: displaying the info in the
MessageBox.Show(Response);
Well, the previous code shows the control (is it a dialog by any
chance?) and *then* adds it to your form, which is somewhat
counterintuitive.
I strongly suspect it's a dialog, as otherwise you wouldn't have any
information when you ask for it - you've got to block for the user to
say yes/no.
As cjard said, it's better to reuse MessageBox in general. However, if
you really want to go your current route, could you provide a short
but complete program which demonstrates the problem?
See http://pobox.com/~skeet/csharp/complete.html for what I mean by
that.
Jon