[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VB.Net calling Visual Basic 6

Posted on 2007-04-03
9
Medium Priority
?
216 Views
Last Modified: 2013-11-26
I have a VB.net form from which i call a form in a visual basic 6 activeX dll.
.Net requires that i show the visual basic 6 form as modal. This is fine, but when i do this, the vb.net form which called the vb6 form doesnt repaint. So, if the user moves the vb6 form around, the vb.net form underneath looks all screwed up. Does anyone know how to fix this issue?

Thanks
0
Comment
Question by:da4thrza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18847248
Hi da4thrza;

You may try to run the VB 6 code in its own thread. This will allow the VB .Net program to respond to paint events. I have not tried this myself but I see no reason why it would not work.

Fernando
0
 

Author Comment

by:da4thrza
ID: 18847288
thanks for the response. How do i do that? Is there a way to do that but still call the form as modal?
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18847308
What version of VB .Net are you using 2003 or 2005?
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

Author Comment

by:da4thrza
ID: 18847325
vb.net 2005

i am currently calling the DLL like this:
        Dim oVB6DLL As Object

        oVB6DLL = CreateObject("VB6Project.clsMain")

        Call oVB6DLL.ShowMe()

The show me function calls the main vb6 form as modal

thanks
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18847354
Are there any interactions between the .Net form and the VB 6 code?
0
 

Author Comment

by:da4thrza
ID: 18847360
not really. i just need it to launch given some parameters and for the object to be garbage collected once the user closes out of the vb6 form
0
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 18847463
Hi da4thrza;

Try something like this.

    ' Create a variable to hold a thread object
    Private WithEvents BgWorker As New System.ComponentModel.BackgroundWorker

    Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click

        ' Start the thread that will run the VB 6 code
        BgWorker.RunWorkerAsync()

    End Sub

    ' This is where the code is placed that will run in its own thread.
    Private Sub BgWorker_DoWork(ByVal sender As Object, _
        ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BgWorker.DoWork

        Dim oVB6DLL As Object

        oVB6DLL = CreateObject("VB6Project.clsMain")

        ' Because this call is a blocking call the thread will not end until the user
        ' closes the VB 6 form.
        Call oVB6DLL.ShowMe()

        ' Make sure to properly dispose of the object before exiting the thread.

    End Sub

Fernando
0
 

Author Comment

by:da4thrza
ID: 18847490
Thanks a lot Fernando!
0
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 18847540
I am glad it worked out for you. ;=)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question