1,105,556 Community Members

object variable or with block variable not set

Member Avatar
vasanth.kanna
Newbie Poster
7 posts since Jan 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
samir_ibrahim
Junior Poster
154 posts since Sep 2008
Reputation Points: 58 [?]
Q&As Helped to Solve: 19 [?]
Skill Endorsements: 3 [?]
 
0
 

Use the "New" Keyword

Dim frm As New TestInterop.InteropForm1
frm.Show

Member Avatar
CodeDoctor
Light Poster
25 posts since Sep 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 6 [?]
Skill Endorsements: 0 [?]
 
0
 

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
You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article