Home All Groups Group Topic Archive Search About

Using Comm dll file in vb.net 2003 error

Author
1 Apr 2005 6:43 PM
gv
Hi all,

using vb.net 2003

Imported a com dll under Reference

Im trying to use one of the classes but keep getting an error:

"Object reference not set to an instance of an object."

Using it like this:

        Dim getduration As String
        Dim rd As BVEvent
        getduration = rd.Duration
        MessageBox.Show(getduration)

I tried changing this line to this, but gave same error and underlined rd:

Dim rd As New BVEvent

thanks for any help
GV

Author
1 Apr 2005 7:30 PM
Herfried K. Wagner [MVP]
Show quote Hide quote
"gv" <viat***@musc.edu> schrieb:
> Imported a com dll under Reference
>
> Im trying to use one of the classes but keep getting an error:
>
> "Object reference not set to an instance of an object."
>
> Using it like this:
>
>        Dim getduration As String
>        Dim rd As BVEvent
>        getduration = rd.Duration
>        MessageBox.Show(getduration)
>
> I tried changing this line to this, but gave same error and underlined rd:
>
> Dim rd As New BVEvent

A runtime error or a compile time error?  'Dim rd As New BVEvent' should
work...

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
1 Apr 2005 7:35 PM
gv
thanks for your help

thats what i thought but,

still underlines the rd with blue squiggly line?

thanks
GV


Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:OshtvDvNFHA.3076@tk2msftngp13.phx.gbl...
> "gv" <viat***@musc.edu> schrieb:
>> Imported a com dll under Reference
>>
>> Im trying to use one of the classes but keep getting an error:
>>
>> "Object reference not set to an instance of an object."
>>
>> Using it like this:
>>
>>        Dim getduration As String
>>        Dim rd As BVEvent
>>        getduration = rd.Duration
>>        MessageBox.Show(getduration)
>>
>> I tried changing this line to this, but gave same error and underlined
>> rd:
>>
>> Dim rd As New BVEvent
>
> A runtime error or a compile time error?  'Dim rd As New BVEvent' should
> work...
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
1 Apr 2005 8:49 PM
Crouchie1998
You may need to import the reference too

Imports SomeReference

Crouchie1998
BA (HONS) MCP MCSE
Author
1 Apr 2005 9:04 PM
Herfried K. Wagner [MVP]
"gv" <viat***@musc.edu> schrieb:
> thats what i thought but,
>
> still underlines the rd with blue squiggly line?

Mhm...  Doesn't it underline 'BVEvent'?  If the namespace that contains
'BVEvent' is imported ('Imports <namespace>') and you are using 'As New'
your code should compile.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
1 Apr 2005 8:46 PM
Crouchie1998
You need to create a new reference to what you are needing to use:

Dim sClass As SomeClass

sClass.SomethingHere = SomeValue

'  Object not set...

-----------------------------

Dim sClass As SomeClass

sClass = New SomeClass

sClass.SomethingHere = SomeValue

-----------------------------

Dim sClass As SomeClass = New SomeClass

sClass.SomethingHere = SomeValue

I  think you get the idea

Crouchie1998
BA (HONS) MCP MCSE