D
djohnson
ok, I have a form that I wish to use as a Dialog Form to edit item details,
when I use the form more than once it becomes unresponsive to setting the
dialogresult.
this app is based on the TaskVision architecture:
in a global class I have a static dialog form item...
declared as such:
************************************************** This is the declaration
in the global class
static ItemDetailForm m_ItemDetailForm;
I also have static methods called:
************************************************** This method is called to
load the form from the splash page
// LOAD ItemDetailForm into Global variable
static public void LoadItemDetailForm()
{
if (m_ItemDetailForm == null)
m_ItemDetailForm = new ItemDetailForm();
}
************************************************** When a button is clicked
on the main form this method is called to return the form object
// RETURN the ItemDetailForm
static public ItemDetailForm GetItemDetailForm()
{
if (m_ItemDetailForm== null)
m_ItemDetailForm= new ItemDetailForm();
return m_ItemDetailForm;
}
************************************************** This is the main form
button code
ItemDetailForm fdf = Global.GetItemDetailForm();
fdf.DataChanged +=new EventHandler(detailform_DataChanged);
fdf.FoodID = FoodID;
fdf.ShowDialog();
************************************************** the first time the above
code is called, everything works fine, the dialog is displayed, I make
modifications to the data and click an update button that does the following
on the dialog form.
DialogResult = DialogResult.OK;
************************************************** this line closes the form
and returns to the calling form correctly.as expected.
if I try to call the dialog form again, it is displayed properly, but the
following line has no impact...
DialogResult = DialogResult.OK;
after this line of code the form acts as though nothing was clicked, in fact
setting dialogresult.cancel has no response as well.
one thing I have tried it setting the form.dialogresult=dialogresult.none
prior to opening the form, with no luck.
I am sort of new to C#, so is there something obvious Im overlooking about
using modaldialogs?
Apreciate any/all help about this matter anyone can provide.
Thanks,
David Johnson
when I use the form more than once it becomes unresponsive to setting the
dialogresult.
this app is based on the TaskVision architecture:
in a global class I have a static dialog form item...
declared as such:
************************************************** This is the declaration
in the global class
static ItemDetailForm m_ItemDetailForm;
I also have static methods called:
************************************************** This method is called to
load the form from the splash page
// LOAD ItemDetailForm into Global variable
static public void LoadItemDetailForm()
{
if (m_ItemDetailForm == null)
m_ItemDetailForm = new ItemDetailForm();
}
************************************************** When a button is clicked
on the main form this method is called to return the form object
// RETURN the ItemDetailForm
static public ItemDetailForm GetItemDetailForm()
{
if (m_ItemDetailForm== null)
m_ItemDetailForm= new ItemDetailForm();
return m_ItemDetailForm;
}
************************************************** This is the main form
button code
ItemDetailForm fdf = Global.GetItemDetailForm();
fdf.DataChanged +=new EventHandler(detailform_DataChanged);
fdf.FoodID = FoodID;
fdf.ShowDialog();
************************************************** the first time the above
code is called, everything works fine, the dialog is displayed, I make
modifications to the data and click an update button that does the following
on the dialog form.
DialogResult = DialogResult.OK;
************************************************** this line closes the form
and returns to the calling form correctly.as expected.
if I try to call the dialog form again, it is displayed properly, but the
following line has no impact...
DialogResult = DialogResult.OK;
after this line of code the form acts as though nothing was clicked, in fact
setting dialogresult.cancel has no response as well.
one thing I have tried it setting the form.dialogresult=dialogresult.none
prior to opening the form, with no luck.
I am sort of new to C#, so is there something obvious Im overlooking about
using modaldialogs?
Apreciate any/all help about this matter anyone can provide.
Thanks,
David Johnson