473,836 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can forms in different projects reference one another?

Me again. Is it possible to have two projects in a solution (ProjA and
ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried
the following, but I get a problem with the reference

Sub ShowFormB
Dim frm as new < ? FormB?? various things I tried here>
frm.Show()
Me.Close()
End Sub

Thanks

Sep 25 '06 #1
7 2316
MikeB,

ProjA must have a reference to ProjB. In the Solution Explorer window,
right-click ProjA and select Add Reference. From the Add Reference dialog,
click the Projects tab and select ProjB.

Now your ProjA can show a form in ProjB:

Dim frm As New ProjB.SomeForm
frm.Show()

Kerry Moorman

"MikeB" wrote:
Me again. Is it possible to have two projects in a solution (ProjA and
ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried
the following, but I get a problem with the reference

Sub ShowFormB
Dim frm as new < ? FormB?? various things I tried here>
frm.Show()
Me.Close()
End Sub

Thanks

Sep 25 '06 #2

"Kerry Moorman" <Ke**********@d iscussions.micr osoft.comwrote in message
news:33******** *************** ***********@mic rosoft.com...
MikeB,

ProjA must have a reference to ProjB. In the Solution Explorer window,
right-click ProjA and select Add Reference. From the Add Reference dialog,
click the Projects tab and select ProjB.

Now your ProjA can show a form in ProjB:

Dim frm As New ProjB.SomeForm
frm.Show()

Kerry Moorman

"MikeB" wrote:
>Me again. Is it possible to have two projects in a solution (ProjA and
ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried
the following, but I get a problem with the reference

Sub ShowFormB
Dim frm as new < ? FormB?? various things I tried here>
frm.Show()
Me.Close()
End Sub

Thanks

This is kinda tricky. What I would prefer in my own projects would be to
create a separate library project for the shared forms. This project would
then be referenced by the two winforms projects. This prevents circular
references from occurring.

HTH,
Mythran
Sep 25 '06 #3
Kerry, thank you.

Does this mean that the Projects have to have names consisting of one
word only? Is there a way to (for instance) use "Host Country" and
"Travel Information" as project names?

MikeB

Kerry Moorman wrote:
MikeB,

ProjA must have a reference to ProjB. In the Solution Explorer window,
right-click ProjA and select Add Reference. From the Add Reference dialog,
click the Projects tab and select ProjB.

Now your ProjA can show a form in ProjB:

Dim frm As New ProjB.SomeForm
frm.Show()

Kerry Moorman

"MikeB" wrote:
Me again. Is it possible to have two projects in a solution (ProjA and
ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried
the following, but I get a problem with the reference

Sub ShowFormB
Dim frm as new < ? FormB?? various things I tried here>
frm.Show()
Me.Close()
End Sub

Thanks
Sep 25 '06 #4
MikeB,

You can have mutliple word project names, such as "Host Country". But I
think that the space gets replaced by an underscore by .Net, like this:

Dim frm As New Host_Country.So meForm

Kerry Moorman
"MikeB" wrote:
Kerry, thank you.

Does this mean that the Projects have to have names consisting of one
word only? Is there a way to (for instance) use "Host Country" and
"Travel Information" as project names?

MikeB

Kerry Moorman wrote:
MikeB,

ProjA must have a reference to ProjB. In the Solution Explorer window,
right-click ProjA and select Add Reference. From the Add Reference dialog,
click the Projects tab and select ProjB.

Now your ProjA can show a form in ProjB:

Dim frm As New ProjB.SomeForm
frm.Show()

Kerry Moorman

"MikeB" wrote:
Me again. Is it possible to have two projects in a solution (ProjA and
ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried
the following, but I get a problem with the reference
>
Sub ShowFormB
Dim frm as new < ? FormB?? various things I tried here>
frm.Show()
Me.Close()
End Sub
>
Thanks
>
>

Sep 25 '06 #5
"Kerry Moorman" <Ke**********@d iscussions.micr osoft.comschrie b:
You can have mutliple word project names, such as "Host Country". But I
think that the space gets replaced by an underscore by .Net, like this:

Dim frm As New Host_Country.So meForm
In this case I'd set a more appropriate root namespace in the project
properties.

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

Sep 25 '06 #6
That's all well and good but when you are writing and debugging code, it's a
pain to load the library class and change it's code...also hard to find some
errors. That's the beauty of putting all your related projects into one
solution at least until you've finished debugging them.
--
Dennis in Houston
"Mythran" wrote:
>
"Kerry Moorman" <Ke**********@d iscussions.micr osoft.comwrote in message
news:33******** *************** ***********@mic rosoft.com...
MikeB,

ProjA must have a reference to ProjB. In the Solution Explorer window,
right-click ProjA and select Add Reference. From the Add Reference dialog,
click the Projects tab and select ProjB.

Now your ProjA can show a form in ProjB:

Dim frm As New ProjB.SomeForm
frm.Show()

Kerry Moorman

"MikeB" wrote:
Me again. Is it possible to have two projects in a solution (ProjA and
ProjB) and have Form1 in ProjA do a .Show() for Form2 in ProjB? I tried
the following, but I get a problem with the reference

Sub ShowFormB
Dim frm as new < ? FormB?? various things I tried here>
frm.Show()
Me.Close()
End Sub

Thanks


This is kinda tricky. What I would prefer in my own projects would be to
create a separate library project for the shared forms. This project would
then be referenced by the two winforms projects. This prevents circular
references from occurring.

HTH,
Mythran
Sep 26 '06 #7

"Dennis" <De****@discuss ions.microsoft. comwrote in message
news:23******** *************** ***********@mic rosoft.com...
That's all well and good but when you are writing and debugging code, it's
a
pain to load the library class and change it's code...also hard to find
some
errors. That's the beauty of putting all your related projects into one
solution at least until you've finished debugging them.
--
Dennis in Houston
"Mythran" wrote:
>>
"Kerry Moorman" <Ke**********@d iscussions.micr osoft.comwrote in message
news:33******* *************** ************@mi crosoft.com...
Yeah, you would put these shared forms into a project that is part of the
same solution and reference this project as a project reference from the two
winforms projects.

Mythran
Sep 26 '06 #8

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

Similar topics

0
1041
by: Jakub G | last post by:
Hi, I’m creating a project which uses Satellite Assemblies (SA) to isolate localized resources. The solution contains eight library projects, one GUI control project and one Windows Form project. I know how to approach SA for library projects, but I do not have any idea how to do it for Windows Forms and Controls. Should I use Localizable properties on every win form and win control that I create and copy resource files associated...
14
1829
by: RL Stevenson | last post by:
What is a reasonable way to manage a complex form with 5 or so tabs with 100 or more controls bound to 5-10 tables in a database? Pasting all those controls, datasets, data adapters directly onto the form resulted in an unwieldy file of nearly 10,000 lines of code. Seems like there must be a better way.
4
3545
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
0
3065
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
27
1768
by: Marc Reinig | last post by:
I have a program written in Visual Studio 2003 Visual Basic. I would like to move it to Visual C++. Is there an automated or relatively automated way of doing that, or do I need to recreate all the windows by hand? Thanks in advance, Marco ------------------------------------------------- Marc Reinig
17
5111
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also identifying memory leaks. The application in question is the Mozilla Web Browser. I also have had similar tasks before in the compiler construction area. And it is easy to come up with many more examples, where such kind of statistics can be very...
12
11121
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
4
5725
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and everyting is secured by Invoke/BeginInvoke, and synchronisation primitves like WaitHandles, Evetns, Semaphores, etc... All works good and with no race conditions or locks. I have a System.Windows.Forms.Timer in the main
10
1640
by: =?Utf-8?B?MjJQb20=?= | last post by:
Hi All, Thanks to Family Tree Mike I've managed to get a Solution up and running, now comes the fun part. How do I call forms from other Class Libraries and how do I use a Background form behind other forms in different Class Libraries? Best Rgds 22Pom
0
9656
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10819
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...
1
10567
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
10237
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
9349
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
6972
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
5641
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
4437
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
3100
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.