Solved

Upgrade Wizard issues - DefInstance!!

Posted on 2004-03-27
2
299 Views
Last Modified: 2008-03-17
Hi,

Thanks for clicking.

I've converted over my appication from vb6 to vb.net.

As part of the upgrade wizard it uses DefInstance property to reference controls within a form from outside that form.

I've hit problems with DefInstance when initializing a new instance of a form. In short it ends up in a repeating loop due to the initialisation of the form calling DefInstance for a control before form has been initialized properly

Is there a way around using DefInstance?? How are controls referenced from outside that form if creating vb.net project from new.
0
Comment
Question by:StuartK
[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
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
ID: 10704130
Hard to tell without seeing more information about what the converted code looks like.

In VB.NET, you need to have an instance variable to reference something on a form.  That is what DefInstance is supposed to do.  If you are starting with a VB.NET application, you would dimension a variable, and then reference the properties and methods from the variable:

Dim frm As New Form1
MsgBox(frm.TextBox1.Text)

Bob
0
 

Author Comment

by:StuartK
ID: 10869169
Hi Bob,

Noticed this is still open.

Just for your knowledge. Have removed DefInstance by Form1.DefInstance with m_Form1.

Public m_Form1 As Form1

and then

m_Form1 = New Form1

Thanks as always for your help
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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