473,471 Members | 2,533 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Two forms in a single archive

Hi.

I'm trying to put 2 forms in a single archive. For example:

public class from1
....
end class

public class form2
.....
end class

Both in a sinfle file myfile.vb.

When I'm trying to instance the second form I have a reference error in the
resourse archive. I want to do that becasue I'm writing a class which will
become a .dll with a Splash Form a the Main Form of any aplicattion we
design from now on. The splash is always the same and the main form too. The
main form has a treeview which deffers between the different applications we
design.

If you have another idea to this would be welcome.

Thanks.

Jaime
Nov 21 '05 #1
5 1108
"Jaime Lucci" <ja********@hotmail.com> schrieb:
I'm trying to put 2 forms in a single archive.


What archive are you talking about?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
A single archive, for example myarch.vb

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
"Jaime Lucci" <ja********@hotmail.com> schrieb:
I'm trying to put 2 forms in a single archive.


What archive are you talking about?

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

Nov 21 '05 #3
"Jaime Lucci" <ja********@hotmail.com> schrieb:
A single archive, for example myarch.vb


"archive" = "file"?!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #4
"Jaime Lucci" <ja********@hotmail.com> schrieb:
I'm trying to put 2 forms in a single archive. For example:

public class from1
...
end class

public class form2
....
end class

Both in a sinfle file myfile.vb.

When I'm trying to instance the second form I have a reference error in
the
resourse archive.


Are you talking about the ResX file?

I strongly suggest to place each form in a separate code file. This will
make editing the forms in the Windows Forms designer easier and prevent
resources from getting screwed up. Note that it's completely irrelevant if
classes are placed in separate code files or in a single code file for the
appearance of the object model. You can still compile both forms into a
single DLL by adding both ".vb" files to the same project.

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

Nov 21 '05 #5
You actually mean a single file, right?

I'm interested as in why you want to even put them in the same file.
But that shouldn't really matter. The compiler lets you place as many
classes as you want in a single file. I've never run into the
reference error that you're talking about. Are you talking about
"Object reference not set to an instance of an object"? If that's the
case, you need to instantiate your objects.

Are you a developer that has moved on to VB .NET from VB 6? You have
to remember that .NET is an object oriented environment and that
everything is an object, including forms.

When you want to display your splash form, you'll have to instantiate
it from your main form and then show it.

Assuming that you're loading the splash form from the main form's load
event, you'll just need to add the following code.

dim f2 as New Form2 'Make note of the New keyword. That instantiates
the object and tells .NET to create it.
f2.Show()

That should do it if you're experiencing the error that I mentioned
above.

I would still advise against creating the two classes in a single file
as it could lead to harder to read code. I would just add a new form
to the project and have two separate files. There's really no need to
have a single file. If you're concerned about how it will appear the
Solution Explorer, you can add a folder, and place classes in that sub
folder. That can help you organize your code. Hope this helps.

Derek Woo

Nov 21 '05 #6

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

Similar topics

0
by: jon | last post by:
Using Visual C++ and MFC, one could generate a very nice MMI using CFormView and the method detailed in the MSDN "vswap" example to allow multiple forms to be viewed ( switched to ) within a single...
1
by: ABC | last post by:
I have a new project which is a web site used by Internal and External users (login required users) and public users (no login required users). On internal users, all users login network using...
24
by: Nak | last post by:
Hi there, I have some inherited forms that I wish to make "localizable", unfortunately none of the items I wish to be "localizable" are actually being "localized". For example, I have a few of...
20
by: Peter Oliphant | last post by:
How does one launch multiple forms in an application? Using Photoshop as an example, this application seems to be composed of many 'disjoint' forms. Yet, they all seem somewhat 'active' in...
2
by: Randall Parker | last post by:
Some questions on forms authentication: 1) Can one do one's own checking of username and password and totally bypass calling FormsAuthentication.Authenticate? 2) does the "new...
7
by: ashley.ward | last post by:
We have been using VB6 to develop small custom apps that access an Oracle database, in order to extend a larger product that is developed by our colleagues in Germany (who use C++ and Java). As...
5
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the...
1
by: Sean | last post by:
Hi, I've taken over a website, which has an admin section that is currently open. I added Forms Authentication to the admin directory with the using the location section in web.config: ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
1
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...
0
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.