473,880 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB 6 LOAD form to VB.NET Question

I am trying to learn VB.Net and can't figure out how to call a from from
another form. In VB6, I just issue a Load FormX, and an Unload FormX... and
Show the form and there it is.

I am sure it is obvious, but I can't see how to do that in VB.net. Does
someone have a piece of code that will call a from from another form and
have it appear.

Thanks,

Michael Erlewine
mi*****@erlewin e.ent
Nov 21 '05 #1
7 8665
"Michael Erlewine" <mi*****@erlewi ne.net> wrote in news:BQGMd.2650 3
$1*******@fe06. lga:
I am trying to learn VB.Net and can't figure out how to call a from from
another form. In VB6, I just issue a Load FormX, and an Unload FormX... and Show the form and there it is.

I am sure it is obvious, but I can't see how to do that in VB.net. Does
someone have a piece of code that will call a from from another form and
have it appear.

Thanks,

Michael Erlewine
mi*****@erlewin e.ent


dim f2 as new form2
f2.show
'once f2 closes we return here
'f2 is still available, and could be shown again
'we can get info from f2 still:
myString = f2.TextBox1.tex t
'dispose will get rid of the form
f2.dispose
Nov 21 '05 #2
j00ls code does the trick, but it's worth explaining.

In .NET everything you work with is an object. So, when you add a form to
your project what you are creating is a class containing code that defines
the look, feel and behaviour of the form. To load the form then, you have to
instantiate the class. It's the same as if I'd defined a class called Pete
and wanted an object from it

Dim myPete as New Pete()

That turns my Pete class into an object. So, if you have a form class called
Form2 (as in J00ls code) you'll need to first turn that class into an object

Dim myForm as new Form2()

Then, having turned it into an object, you can go ahead and call methods on
it, like Show()

myForm.Show()
Hope that makes sense. Take a look at the programming with objects guides in
the online help for more info on how to do OO with VB.NET. It's weird at
first when you move across from VB6, but ultimately it makes a lot more
sense than the old VB6 way of doing things.

--
Pete Wright
Author of ADO.NET Novice to Pro for Apress
www.petewright.org

"Michael Erlewine" <mi*****@erlewi ne.net> wrote in message
news:BQ******** **********@fe06 .lga...
I am trying to learn VB.Net and can't figure out how to call a from from
another form. In VB6, I just issue a Load FormX, and an Unload FormX... and
Show the form and there it is.

I am sure it is obvious, but I can't see how to do that in VB.net. Does
someone have a piece of code that will call a from from another form and
have it appear.

Thanks,

Michael Erlewine
mi*****@erlewin e.ent

Nov 21 '05 #3
Michael,

"Michael Erlewine" <mi*****@erlewi ne.net> schrieb:
I am trying to learn VB.Net and can't figure out how to call a from from
another form. In VB6, I just issue a Load FormX, and an Unload FormX... and
Show the form and there it is.


There is no 'Load' and 'Unload' any more. Forms in .NET are "normal"
classes.

Showing a form:

\\\
Dim f As New FooForm()
f.Show()
///

Showing a form modally:

\\\
Dim f As New FooForm()
f.ShowDialog()
f.Dispose()
///

Notice that forms which are shown modally are not disposed automatically
when they are closed, that's why you should call 'Dispose' explicitly.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
Thanks all of you for that first step, which brings me to the gate of
the second step: How do I create that 2nd form to be loaded?

In VB6, I just ADD a blank form, populate it with controls, and then
call it. How do I do that in VB.net

Thanks,

Michael Erlewine

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #5
I got the Form to load and I figured out how to ADD A FORM to the
project. I have another question.

Much of my work is in FoxPro. All I need is to read a FREE .DBF table,
and transfer the data to variables in VD.net and use them.

I installed the VFP OLE DB data provider.

Now I need to see a sample piece of code that works that reads a free
DBF table using a search for a unique character phrase in one field, and
then gets data from a couple other character fields and a couple of Memo
Fields. Any help would be appreciated.

Thanks,

Michael Erlewine

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #6
I am getting BUILD ERRORS like"Type 'Introduction' is not Defined."

'Introduction is the name of a form I am using.

The code looks like this:

Dim f3 As New Introduction()
F3.ShowDialog()
f3.dispose()

Any ideas?
Thanks,

Michael Erlewine
mi*****@erlewin e.ent
Nov 21 '05 #7
On Fri, 04 Feb 2005 06:17:44 -0800, Michael Erlewine <mi*****@erlewi ne.net> wrote:

¤ I got the Form to load and I figured out how to ADD A FORM to the
¤ project. I have another question.
¤
¤ Much of my work is in FoxPro. All I need is to read a FREE .DBF table,
¤ and transfer the data to variables in VD.net and use them.
¤
¤ I installed the VFP OLE DB data provider.
¤
¤ Now I need to see a sample piece of code that works that reads a free
¤ DBF table using a search for a unique character phrase in one field, and
¤ then gets data from a couple other character fields and a couple of Memo
¤ Fields. Any help would be appreciated.
¤

See the following:

Accessing Visual FoxPro Data in Visual Studio .NET
http://msdn.microsoft.com/library/de...lstudionet.asp
Paul ~~~ pc******@amerit ech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3542
by: Marc | last post by:
When I add controls to a form and run the .exe under Win XP, the outline of the form displays first and then the controls on the form. The .exe works fine but the initial show looks like the computer is running slow because the form does not show all at once. It shows one control at a time. Yes, I do have functions in the form_load event but even if I remove these functions, the same slow looking show occurs. This did not occur in VB6 unless...
11
1691
by: Johnny M | last post by:
I have several databases where I have one form to add a new record and one form to edit an existing record. I use unbound forms and class modules most of the time. What I would like to do is have one form that handles both adding a new record to the database and editing the same type of record. The form would be altered in the load event to change whatever needs to be changed to show the form in an "Add" mode vs. and "Edit" mode (I...
3
1702
by: ChadDiesel | last post by:
I'm new to Access and need some advice. I am trying to setup a database to print labels and reports for our shipments. I have set up a table with fields such as I have taken a snapshot of what I would like to do: http://www.chadworld.com/images/form.jpg All of these fields are in a table called: Ship_Info
4
1613
by: Dan | last post by:
I am back yet again :) I am encountering an Exception that has me scratching my head. I have two forms. Form A launches Form B in response to the user clicking a button. The Constructor for Form B takes 5 parameters but none of them complicated ( three short strings and two booleans ). Form B does have several controls on it (around 148 when you count in group boxes, labes and menus). However, I have forms with far more that load...
4
1232
by: Paul | last post by:
Is there any way of making the following code into a function so that I don't have to re-use the same code for all my buttons? I've tried to do this with the code at the bottom of my post but I get a build error saying 'Type FormToShow is not defined'. Cheers, Paul Private WithEvents Example1Form As frmDragDropFromExplorer
1
1538
by: adam | last post by:
I have a simple form question. I order to access a payment gateway I have a asp.net page which has to have a form that use POST for method and _blank for target. Before the information of the form can be send of, a checksum has to be calculated. I want to calculate the checksum server side for security reasons. The way I do it the checksum is not calculated before the form I posted. The following is simplified content of the aspx . ...
3
12144
by: MacDermott | last post by:
The help file in Access 2000 has entries for Load and Show, suggesting a usage similar to that in VB6.0. But code like this fails: Dim Frm as object Set Frm=CurrentProject.AllForms(0) Load Frm with an error that the object can't be loaded or unloaded. Anyone have any experience with this?
8
7563
by: Mitch5713 | last post by:
I've got tthree forms at start up splashscreen- works fine however how do i set the time delay so it stays on the window longer,, shows longer?? Loginscreen- works fine, after the data processing of username etc is done I then need to load, call whatever the syntax is the mainForm at the end of the loginscreen..????? how is that done so it starts at the mainForm_Load procedure??? As it stands now the mainform loads but just for a split...
10
15346
by: sara | last post by:
Hi - I have been struggling with solution ideas for this now for almost 2 weeks, and have not been able to figure this out. I have a user who creates a Purchase Order (tblPOData). In some circumstances, this or another user must create an invoice to go with the PO (I know - that makes no sense, but this is the business case). I have the user go to a form to create the invoice:
0
11093
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10715
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10811
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10396
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9550
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7105
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5778
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4596
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3220
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.