Solved

Upgrade Wizard issues - DefInstance!!

Posted on 2004-03-27
2
295 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
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 125 total points
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now