PC Review


Reply
Thread Tools Rate Thread

cannot implicitly convert type System.EventHandler .NET

 
 
Terminal882003@yahoo.com
Guest
Posts: n/a
 
      28th Jan 2004
Hi,

Here I have a question about MSCommLib. I need to dynamically add
activeX controls that requires run-time license for MSCommLib. The
following is the actual code:

AxMSCommLib.AxMSComm mscomm = new AxMSCommLib.AxMSComm();

string strLicense = "gfjmrfkfifkmkfffrlmmgmhmnlulkmfmqkqj";

System.Reflection.FieldInfo f =
typeof(AxHost).GetField("licenseKey",
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance);
f.SetValue(mscomm, strLicense);

mscomm.OnComm += new MSCommLib.DMSCommEvents_OnCommEventHandler
(this.mscomm_OnComm);

When I compile the above code, I get an error: "Cannot implicitly
convert type 'MSCommLib.DMSCommEvents_OnCommEventHandler' to
'System.EventHandler'".

Any advice about this problem is more than welcome.

Thanks,
Mindy
 
Reply With Quote
 
 
 
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      29th Jan 2004
Hi,

Ensure the mscomm.OnComm event indeed has the
MSCommLib.DMSCommEvents_OnCommEventHandler type and that the
this.mscomm_OnComm method has the signature matching the event delegate's
one.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> Here I have a question about MSCommLib. I need to dynamically add
> activeX controls that requires run-time license for MSCommLib. The
> following is the actual code:
>
> AxMSCommLib.AxMSComm mscomm = new AxMSCommLib.AxMSComm();
>
> string strLicense = "gfjmrfkfifkmkfffrlmmgmhmnlulkmfmqkqj";
>
> System.Reflection.FieldInfo f =
> typeof(AxHost).GetField("licenseKey",
> System.Reflection.BindingFlags.NonPublic |
> System.Reflection.BindingFlags.Instance);
> f.SetValue(mscomm, strLicense);
>
> mscomm.OnComm += new MSCommLib.DMSCommEvents_OnCommEventHandler
> (this.mscomm_OnComm);
>
> When I compile the above code, I get an error: "Cannot implicitly
> convert type 'MSCommLib.DMSCommEvents_OnCommEventHandler' to
> 'System.EventHandler'".
>
> Any advice about this problem is more than welcome.
>
> Thanks,
> Mindy


 
Reply With Quote
 
Terminal882003@yahoo.com
Guest
Posts: n/a
 
      29th Jan 2004
Hi Dmitriy,

Thanks for your reply. This is exactly my problem. Please let me know
how to make the mscomm.OnComm event has
MSCommLib.DMSCommEvents_OnCommEventHandler type. I really appreciate
your help.

Mindy

"Dmitriy Lapshin [C# / .NET MVP]" <x-(E-Mail Removed)> wrote in message news:<#(E-Mail Removed)>...
> Hi,
>
> Ensure the mscomm.OnComm event indeed has the
> MSCommLib.DMSCommEvents_OnCommEventHandler type and that the
> this.mscomm_OnComm method has the signature matching the event delegate's
> one.
>
> --
> Dmitriy Lapshin [C# / .NET MVP]
> X-Unity Test Studio
> http://x-unity.miik.com.ua/teststudio.aspx
> Bring the power of unit testing to VS .NET IDE
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > Here I have a question about MSCommLib. I need to dynamically add
> > activeX controls that requires run-time license for MSCommLib. The
> > following is the actual code:
> >
> > AxMSCommLib.AxMSComm mscomm = new AxMSCommLib.AxMSComm();
> >
> > string strLicense = "gfjmrfkfifkmkfffrlmmgmhmnlulkmfmqkqj";
> >
> > System.Reflection.FieldInfo f =
> > typeof(AxHost).GetField("licenseKey",
> > System.Reflection.BindingFlags.NonPublic |
> > System.Reflection.BindingFlags.Instance);
> > f.SetValue(mscomm, strLicense);
> >
> > mscomm.OnComm += new MSCommLib.DMSCommEvents_OnCommEventHandler
> > (this.mscomm_OnComm);
> >
> > When I compile the above code, I get an error: "Cannot implicitly
> > convert type 'MSCommLib.DMSCommEvents_OnCommEventHandler' to
> > 'System.EventHandler'".
> >
> > Any advice about this problem is more than welcome.
> >
> > Thanks,
> > Mindy

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot implicitly convert type 'string' to 'System.Web.UI.WebControls.TextBoxMode' jc Microsoft C# .NET 3 9th Dec 2008 02:55 PM
cannot implicitly convert type Jeff Microsoft C# .NET 2 20th Oct 2005 03:15 PM
err: Cannot implicitly convert type 'string' to 'System.Drawing.Co =?Utf-8?B?b3JpdA==?= Microsoft Dot NET Framework Forms 4 11th May 2005 05:49 AM
Cannot implicitly convert type 'object' to 'System.Xml.XmlDocument' Error Patrick Olurotimi Ige Microsoft ASP .NET 3 4th May 2005 06:21 AM
cannot implicitly convert type MSCOMMLib System.EventHandler .NET Terminal882003@yahoo.com Microsoft Dot NET 0 28th Jan 2004 07:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:50 AM.