Vb.NET Form from VB6 -> Tab problem

  • Thread starter Thread starter Markus Tsch?p
  • Start date Start date
M

Markus Tsch?p

Hi everyone,

I have a problem with the behaviour of the tab key when showing a .NET
form from a visual basic 6 application.
The tab key works probably if I show the .NET form with .ShowDialog()
and you can jump from one textbox to the other. But if I show it with
..Show() there?s no result (expect of a beep) when I hit the tab key or
the focus returns to the calling VB6 application (depends on where the
focus in the calling application is). I think it?s because if a .NET
form is shown nonmodally there?s no separate message queue for this
form.
I?ve already found some posts on this problem but still no solution
for it. Please can anyone help? It?s very important for us to properly
integrate our new .NET component in our existing VB6 application.


Thanks a lot for any help

Markus


P.S.: Please excuse my English, it?s not the very best.
 
Hi Markus,

You need to create a new thread in .net and then start the new message pump

Here is an example. This way there will be a message pump associated with this
.net form.

Imports System.Threading
Imports System.Windows.Forms

Public Class Class1
Public Sub ShowMyForm()
Dim NewThreadStart As New ThreadStart(AddressOf Me.Start)
Dim NewThread As New Thread(NewThreadStart)
NewThread.Start()
End Sub

Private Sub Start()
Dim myForm1 As New Form1()
Application.Run(myForm1)
End Sub
End Class


VB6 Code
--------------
Private Sub Command1_Click()
Dim cls As ClassLibrary1.Class1
Set cls = New ClassLibrary1.Class1
cls.ShowMyForm
End Sub



Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
Back
Top