Hello Friends,

When i try to show VB.net interop forms within VB 6.0 i have got the error "object variable or with block variable not set ". I was create interop form library in vb.net and use the created TLB as a referece in VB 6.0 and in button click i write the following code.

Dim frm As TestInterop.InteropForm1
frm.Show

when i run the vb project and click on the button i got the above error.
Can you please provide a solution for this. Please reply me as early as possible.

Regards,
Vasanth.

Use the "New" Keyword

Dim frm As New TestInterop.InteropForm1
frm.Show

Hello Friends,

When i try to show VB.net interop forms within VB 6.0 i have got the error "object variable or with block variable not set ". I was create interop form library in vb.net and use the created TLB as a referece in VB 6.0 and in button click i write the following code.

Dim frm As TestInterop.InteropForm1
frm.Show

when i run the vb project and click on the button i got the above error.
Can you please provide a solution for this. Please reply me as early as possible.

Regards,
Vasanth.

You will need to Instantiate the form before you use it.

Dim frm As [B]New[/B] TestInterop.InteropForm1
frm.Show
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.