Ivan Debono
1/6/2003 2:23:00 PM
Hi ppl,
I have a problem which I cannot solve!!
The following is the code for my webform (removing page_load, etc). The
class Notify inherits from a VB6 component (an ActiveX.EXE) and implements
just an event and a property. Button1_click connects to the server... so far
so good. After a specified time, the server sends back to the oNot object
that a search has been completed and the code goes into
_IDomSearchNotify.Done in the class Notify.
Now the problems start:
1. in _IDomSearchNotify.Done, the Done variable is null. I don't know why.
2. how can I return something to the main WebForm1 class from the Notify
class. ie. a search was completed, and I want to display a message in a
label. Any webcontrols are not accessible in the nested (notify class)
Any ideas or suggestions??
Thanks,
Ivan
namespace TestNotify
{
public class WebForm1: System.Web.UI.Page
{
//Webpage controls
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Label Label1;
//Notify class (nested)
public class Notify: IDomSearchNotify
{
private string sGUID = null;
public event __IDomSearchNotify_DoneEventHandler Done;
void _IDomSearchNotify.Done(ref bool bolCanceled)
{
if (Done != null)
Done(ref bolCanceled);
}
string _IDomSearchNotify.SearchGUID
{
get
{
return sGUID;
}
set
{
sGUID = value;
}
}
}
//Class fields
private Dispatcher disp = null;
private Monitor mont = null;
private IDomSearchNotify oNot = new Notify();
private IDomRunningSearch oRun = null;
private bool bCnx = false;
private string sMsg = null;
private void Button1_Click(object sender, System.EventArgs e)
{
disp = new DispatcherClass();
if (disp != null)
mont = disp.DispatchMonitor;
if (mont != null)
mont.StartSearchAsync(oNot, ref oRun, "f975250", "pwd", "loc",
"azv40glay", "2222", 9, ref sMsg);
//Show the returned GUID
Label1.Text = oNot.SearchGUID;
}
private void Button2_Click(object sender, System.EventArgs e)
{
bCnx = true;
oNot.Done(ref bCnx);
}
}
}