473,805 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reference form from one project in another?

I have two projects in one solution:

a.. Outlook Monitor
b.. Tray Notification
Both contain a form called "Form1.vb". How do I reference "Outlook
Monitor"'s Form1 from "Tray Notification"'s form1? Here's my code example
taken from "Tray Notification"'s form1:

Code:
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'--- Create ContextMenu
'Dim TrayContextMenu As ContextMenu = New ContextMenu

'Add itens on ContextMenu
TrayContextMenu .MenuItems.Add( "&Restore", New
System.EventHan dler(AddressOf Me.mnuRestore_c lick))
TrayContextMenu .MenuItems.Add( "-")
TrayContextMenu .MenuItems.Add( "&Exit", New
System.EventHan dler(AddressOf Me.mnuExit_clic k))

'--- Create NotifyIcon
'Dim TrayNotifyIcon As BalloonTip = New BalloonTip

' Show Notify Icon
TrayNotifyIcon. Text = Me.Text ' Help text for MouseLeave on Icon
TrayNotifyIcon. Icon = Me.Icon ' Icon for NotifyIcon
TrayNotifyIcon. Form = Me ' Form to restore when DoubleClick on Icon
TrayNotifyIcon. ContextMenu = TrayContextMenu ' ContextMenu for
RightClick on Icon
TrayNotifyIcon. Visible = True ' Show icon in TaskBar

' Show Balloon Tip
TrayNotifyIcon. ShowBalloon(Me. Text, "Line 1" + vbLf + "Line 2",
BalloonTip.Noti fyInfoFlags.Inf o, 1000)
End Sub
I want to change the three lines of code under the line "' Show Notify Icon"
to reference the other project's form.

--
|
+-- Thief_
|
Nov 21 '05 #1
1 1911
Use an imports statement then a qualifier for form1, i.e., in your
Traynotificatio n project module where you want to call Outlook Monitor's
Form1,

Imports OutlookMonitor (or whatever the project is labeled in the solution
explorer)
Then to show the form;

OutlookMonitor. Form1.Show

I think this is what you need. Good Luck
--
Dennis in Houston
"Thief_" wrote:
I have two projects in one solution:

a.. Outlook Monitor
b.. Tray Notification
Both contain a form called "Form1.vb". How do I reference "Outlook
Monitor"'s Form1 from "Tray Notification"'s form1? Here's my code example
taken from "Tray Notification"'s form1:

Code:
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'--- Create ContextMenu
'Dim TrayContextMenu As ContextMenu = New ContextMenu

'Add itens on ContextMenu
TrayContextMenu .MenuItems.Add( "&Restore", New
System.EventHan dler(AddressOf Me.mnuRestore_c lick))
TrayContextMenu .MenuItems.Add( "-")
TrayContextMenu .MenuItems.Add( "&Exit", New
System.EventHan dler(AddressOf Me.mnuExit_clic k))

'--- Create NotifyIcon
'Dim TrayNotifyIcon As BalloonTip = New BalloonTip

' Show Notify Icon
TrayNotifyIcon. Text = Me.Text ' Help text for MouseLeave on Icon
TrayNotifyIcon. Icon = Me.Icon ' Icon for NotifyIcon
TrayNotifyIcon. Form = Me ' Form to restore when DoubleClick on Icon
TrayNotifyIcon. ContextMenu = TrayContextMenu ' ContextMenu for
RightClick on Icon
TrayNotifyIcon. Visible = True ' Show icon in TaskBar

' Show Balloon Tip
TrayNotifyIcon. ShowBalloon(Me. Text, "Line 1" + vbLf + "Line 2",
BalloonTip.Noti fyInfoFlags.Inf o, 1000)
End Sub
I want to change the three lines of code under the line "' Show Notify Icon"
to reference the other project's form.

--
|
+-- Thief_
|

Nov 21 '05 #2

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

Similar topics

1
2222
by: David Gagné | last post by:
Hello, My C# solution is composed of 2 projects, a class library project and a Windows application project. The window in one project calls the DLL in the other. That's ok. Now, to better test the solution I would like to create a new Windows application project in that solution so that my 2 other projects are not impacted by this third project. Now this new project would contain the startup Form from which I could open my Form in the...
1
1934
by: M Shafaat | last post by:
Hi! I have made a user control called, say "MyUserCtrl", which is inherited from another user defined class called, say "MyBaseClass". Each one of these two are developed in its own project. The question: When I use MyUserCtrl in a form, I must, from the form, make reference to both classes, i.e. even to "MyBaseClass". Otherwise, it will not work. How can I manage to skip referencing MyBaseClass? I tried to put both user controls in one...
0
1152
by: PABLIN | last post by:
Add a reference Web to a project Service Web ASP.NET that I created previously: in the Explorer of solutions, I do click with the secondary button of mouse in the AuthorsWinClient project and later I do click in Adding reference Web in the contextual menu. I introduce the location of the file of of the project on watch Web XML (Aqui in this reference is when I remain suspended because it assumes that the reference Web to which...
2
2599
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
1
1086
by: Nicolas | last post by:
I got an exe which include a form MDI ===> FORM A I got another dll wich include a form =====> FORM B In my FORM A I can launch FORM B and assign FORM B.MdiParent = FORM A But from FORM B I cannot launch any functions from FORM A I think that the dll (form B) have no clue about FORM A extra function other then the basic one like text , name etc. How can I refer back to FORM A from FORM B
16
2313
by: Paul S. Natanson | last post by:
What is a Null Reference error and how do I fix it? My newly installed VB.Net2003 gives me a "Microsoft Development Environment" error message box EVERY time I try to run/start ANY project - even very simple ones. The error says: "An unhandled exception of type 'System.NullReferenceException' occurred in
2
2219
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the following Microsoft Development Environment error message displays: "Object reference not set to an instance of an object." Then when I access the design view of one of my forms, the controls on
6
2830
by: liu | last post by:
Hi all, in my vb.net solution, i have 3 project: 1. Main-this is the startup or the base of my window application. 2. Sales-this is the project that contains all the sales info 3. Product-this is the project contains all product info in my Sales project, i added the reference of the Product to Sales project because I need to shows the Product info in my Sales. in the other hand, i also need to show the Sales in my Product. now the
0
2084
by: SammyBar | last post by:
Hi all, My problem is basic. I'm starting to try web services with Visual Studio .NET 2002, .NET Framework 1.0. I'm testing the following configuration for my project. It's a ASP.NET Web Service project in the role of server. It's another project, a Windows Form project to act as the web services client. Both projects are joined in the same solution. I hope this will be the best arrangement to develop in parallel both the server and the...
0
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10613
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
10368
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
10107
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
6876
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
5544
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
4327
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
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
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.