Select to view content in your preferred language

Migrating from VBA to .NET vbModeless

646
1
02-12-2013 11:41 AM
BrianBaldwin1
Deactivated User
Quick question that can hopefully be answered...

I just migrated an old tool from VBA to .NET and I got all the kinks out except one bit of code that I can't find the answer to...

In VBA, the user form was called with this:  UserForm1.Show vbModeless

I have tried to simply enter in UserForm1.Show, or UserForm1.ShowDialog...but neither is working...they both provide me with this error:

"Reference to non-shared member requires an object reference" 

I'm assuming there is a reference I need to add?

Thanks so much,
0 Kudos
1 Reply
NeilClemmons
Honored Contributor
Unlike VB and VBA, VB.NET does not provide global instances of your form classes.  You have to create an instance of a form class before you can show it.

Dim form As New yourForm
form.Show()
0 Kudos