PC Review


Reply
Thread Tools Rate Thread

delegates invoke

 
 
Rohan
Guest
Posts: n/a
 
      11th Aug 2010
Hi,

I am trying to do this example : http://sherlockholmes_cases.tripod.c..._Delegates.htm
i keep getting Object reference not set to an instance of an object.
when i call a m_dlgCEH.Invoke

Anyone could help me ?
thank you

 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      11th Aug 2010
Am 11.08.2010 21:31, schrieb Rohan:
> Hi,
>
> I am trying to do this example : http://sherlockholmes_cases.tripod.c..._Delegates.htm
> i keep getting Object reference not set to an instance of an object.
> when i call a m_dlgCEH.Invoke
>
> Anyone could help me ?


You didn't call Sub SetDlgRef


--
Armin
 
Reply With Quote
 
Rohan
Guest
Posts: n/a
 
      11th Aug 2010
On Aug 11, 4:46*pm, Armin Zingler <az.nos...@freenet.de> wrote:
> Am 11.08.2010 21:31, schrieb Rohan:
>
> > Hi,

>
> > I am trying to do this example :http://sherlockholmes_cases.tripod.c..._Delegates.htm
> > i keep getting Object reference not set to an instance of an object.
> > when i call a m_dlgCEH.Invoke

>
> > Anyone could help me ?

>
> You didn't call Sub SetDlgRef
>
> --
> Armin


Armin, even if i call the Sub SetDlgRef it does not solve my problem,
i still need to initialize the m_dlgCEH delegate, (which i don't know
how to do)
 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      12th Aug 2010
Am 11.08.2010 23:36, schrieb Rohan:
>>
>>> I am trying to do this example :http://sherlockholmes_cases.tripod.c..._Delegates.htm
>>> i keep getting Object reference not set to an instance of an object.
>>> when i call a m_dlgCEH.Invoke

>>
>>> Anyone could help me ?

>>
>> You didn't call Sub SetDlgRef


>
> Armin, even if i call the Sub SetDlgRef it does not solve my problem,
> i still need to initialize the m_dlgCEH delegate, (which i don't know
> how to do)


With the full code from the linked page, I can not reproduce the
problem. That's why I thought you are using the Printer class
but different code to test it. Do you?

If the exception occurs, look at the callstack to see where the InkLevel
property is accessed. That's probably before you call Sub SetDlgRef.
How do you call the Sub (if it's not the code from the page)?

BTW, I can compile it only by switching off some compiler checks
(Option Strict Off).

--
Armin
 
Reply With Quote
 
Rohan
Guest
Posts: n/a
 
      12th Aug 2010
On Aug 11, 7:01*pm, Armin Zingler <az.nos...@freenet.de> wrote:
> Am 11.08.2010 23:36, schrieb Rohan:
>
>
>
> >>> I am trying to do this example :http://sherlockholmes_cases.tripod.c..._Delegates.htm
> >>> i keep getting Object reference not set to an instance of an object.
> >>> when i call a m_dlgCEH.Invoke

>
> >>> Anyone could help me ?

>
> >> You didn't call Sub SetDlgRef

>
> > Armin, even if i call the Sub SetDlgRef it does not solve my problem,
> > i still need to initialize the m_dlgCEH delegate, (which i don't know
> > how to do)

>
> With the full code from the linked page, I can not reproduce the
> problem. That's why I thought you are using the Printer class
> but different code to test it. Do you?
>
> If the exception occurs, look at the callstack to see where the InkLevel
> property is accessed. That's probably before you call Sub SetDlgRef.
> How do you call the Sub (if it's not the code from the page)?
>
> BTW, I can compile it only by switching off some compiler checks
> (Option Strict Off).
>
> --
> Armin


Well, i am using VB,net 2010 and the code is as IS, i did not change
it what so ever,
can it be because of vb.net 2010 ???
 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      12th Aug 2010
Am 12.08.2010 14:05, schrieb Rohan:
> Well, i am using VB,net 2010 and the code is as IS, i did not change
> it what so ever,
> can it be because of vb.net 2010 ???


I don't think so.

First I thought it's because of the trackbar's scroll event that
could occur before form_load, that means before the Sub has been called,
but no matter how I set it's Value property in the designer, the scroll
event does not occur at that point in time.

I've tried it now in VB 2010 and suddenly got the exception. It wasn't
obvious: The "Handles MyBase.Load" was missing! I don't know why. Maybe
because of errors when opening the designer. After adding it back, it
worked again. Have a look there, too. (I didn't try to reproduce again in
VB 2008)

--
Armin
 
Reply With Quote
 
Rohan
Guest
Posts: n/a
 
      12th Aug 2010
On Aug 12, 11:30*am, Armin Zingler <az.nos...@freenet.de> wrote:
> Am 12.08.2010 14:05, schrieb Rohan:
>
> > Well, i am using VB,net 2010 and the code is as IS, i did not change
> > it what so ever,
> > can it be because of vb.net 2010 ???

>
> I don't think so.
>
> First I thought it's because of the trackbar's scroll event that
> could occur before form_load, that means before the Sub has been called,
> but no matter how I set it's Value property in the designer, the scroll
> event does not occur at that point in time.
>
> I've tried it now in VB 2010 and suddenly got the exception. It wasn't
> obvious: The "Handles MyBase.Load" was missing! I don't know why. Maybe
> because of errors when opening the designer. After adding it back, it
> worked again. Have a look there, too. (I didn't try to reproduce again in
> VB 2008)
>
> --
> Armin


Armin i am not to familiar with the Handles MyBase.Load, where would i
added it ?
thank you

 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      12th Aug 2010
Am 12.08.2010 18:45, schrieb Rohan:
>> I've tried it now in VB 2010 and suddenly got the exception. It wasn't
>> obvious: The "Handles MyBase.Load" was missing! I don't know why. Maybe
>> because of errors when opening the designer. After adding it back, it
>> worked again. Have a look there, too. (I didn't try to reproduce again in
>> VB 2008)
>>

>
> Armin i am not to familiar with the Handles MyBase.Load, where would i
> added it ?


Look on the page where you have the code from. It's in the "Sub Form_Load"
line.


--
Armin
 
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
Threads, delegates and invoke function with 2.0 Melina Microsoft C# .NET 7 11th Mar 2010 02:38 AM
Delegates and the Invoke method Dom Microsoft C# .NET 6 18th May 2007 10:54 PM
Asynchronous Invoke and the UI thread (using delegates) =?Utf-8?B?YnJpc2Vycw==?= Microsoft VB .NET 7 6th Mar 2006 06:45 PM
Using Cache expiration to invoke Delegates... Beren Microsoft ASP .NET 4 2nd Oct 2005 08:32 PM
Why Invoke() can be called on .NET framework delegates and not on my own???? Bob Rock Microsoft C# .NET 3 27th Oct 2004 12:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 AM.