Using Comm dll file in vb.net 2003 error

  • Thread starter Thread starter gv
  • Start date Start date
G

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
 
gv said:
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...
 
thanks for your help

thats what i thought but,

still underlines the rd with blue squiggly line?

thanks
GV
 
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
 
You may need to import the reference too

Imports SomeReference

Crouchie1998
BA (HONS) MCP MCSE
 
gv said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top