Solved

Upgrade Wizard issues - DefInstance!!

Posted on 2004-03-27
2
301 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

729 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