473,785 Members | 2,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Startup Form's Name

This is probably a silly question, but I've gotten myself confused.

My app has two forms, form1 and form2. form1 is the start up object in the
propers. An event in form1 instantiates form2.

Dim myForm as HardwareStore
myForm = New HardwareStore
myForm.Show()

I understand that my form2 can be referenced by

myForm.blah

What is the form name for form1 so that I can reference it from form2
(myForm)?

form1.blah

Doesn't work.

Sorry for such a basic question, but I'm trying to learn here, hahaha.

Bernie
Apr 6 '06
10 3003
Bernie,

You want to share a function between two forms.
That the function is now on form1 is in my idea from not any importancy.

It can be a good reason to make a shared class as this function has as well
data in it.
If it has not data than it is bettter just to instance it when it is needed.
Therefore we get something as

Class Form1 etc
Sub Whatever
MyHelperClass.m yStatus = true
end sub

Class Form2 ect
Sub Whatever
dim status = myHelperClass.M yStatus
end sub

Public Class myHelperClass
public shared MyTogle as boolean
Public Shared property MyStatus() as boolean
Get
return MyTogle
End Get
Set(byval value as boolean)
myTogle = value
End Set
End Class

I hope that this gives an idea

Cor

"Bernie Hunt" <bh***@optonlin e.net> schreef in bericht
news:Xn******** *************** ********@207.46 .248.16...
Cor,

I understand and your point makes alot of sense. The basic problem will
still exist in your suggested design.

The problem is I'm having trouble accessing a function in an instatiated
form. Please see the code I posted in my other message. I show the exact
problem there.

If I can get past the amazinly simple syntax problem, then I can worry
about better design, hahahaha.

Bernie
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in
news:eM******** *****@TK2MSFTNG P03.phx.gbl:
Bernie,

It is not impossible. However you would try to avoid it. It can make
your project completely dependend from form2. If you change something
in that than you have forever to think that it can have effects on
form1. And with that ending one of one of the major reasons of OOP.
Maintainability .

You should not try to do things in your class Form2, which are done in
Form1. Create than a special class for that, which you can use in
both.

Just my thought,

Cor

"Bernie Hunt" <bh***@optonlin e.net> schreef in bericht
news:Xn******** *************** ********@207.46 .248.16...
This is probably a silly question, but I've gotten myself confused.

My app has two forms, form1 and form2. form1 is the start up object
in the propers. An event in form1 instantiates form2.

Dim myForm as HardwareStore
myForm = New HardwareStore
myForm.Show()

I understand that my form2 can be referenced by

myForm.blah

What is the form name for form1 so that I can reference it from form2
(myForm)?

form1.blah

Doesn't work.

Sorry for such a basic question, but I'm trying to learn here,
hahaha.

Bernie



Apr 6 '06 #11

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

Similar topics

2
336
by: Imayakumar | last post by:
Hi, I got two forms, named Form1 and Form2 ion a VB.NET Windows application.. by default if i run the application, Form1 gets launched..i need to set Form2 as the startup form how do i do it?? Thanks. Imaya Kumar J.
5
2798
by: mark s | last post by:
How can I make a checkbox that says "Do not show this again at startup" on my reminder form? Thanks! -- name: Mark S. email: huskie_009@hotmail.com *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
3
3051
by: Douglas Buchanan | last post by:
Buttons don't work if form is opened on startup A2k If 'frmMain' is set to open by default at startup none of the buttons work. If 'frmMain' is opened from the database window then all the buttons work. The form's name ('frmMain') is selected from in the Startup dialog box.
1
5378
by: John Michael | last post by:
I have created some password routines to protect certain forms from access without a password. This allows me to create some security for apps that will be used on diff machines for users that will not have to learn the whole access security process and me as well. I would like to lockup my database by unchecking all of the options in the tools/startup from. I know i can create custom menus, toolbars and command bars and add a link to...
7
6901
by: cefrancke | last post by:
I cant seem to find a straight answer on the following. I want to programmatically hide all menus except a basic custom report menu (during report preview) and right click pop-up A-Z sorting on datasheets (for subforms). I would like to do this on startup of the application. To be clear:
1
11322
by: cefrancke | last post by:
I have set the Startup properties to the following... All menus, toolbars, etc are turned off plus these are unchecked Allow Full Menus Allow Built-in Toolbars Allow Default Shortcut Menus Allow Toolbar/Menu Changes Use Access Special Keys
8
26793
by: Brian Fulford | last post by:
This is my first shot at a Winforms application in dot net. This application is mainly going to run unattended but is using a form to display current activity of the background processing. In VB6, I could set the startup to be Sub Main and then call frmMain.Show and the program would continue processing; however, after instantiating the from in VB.Net - dim frmMain as new frmMain, frmMain.show shows the form then closes the form to continue...
4
3908
by: Chris Ashley | last post by:
I have a class called App set as the startup object with the following code: Friend Class App Shared Sub Main() Dim FrmMain As New MainForm Application.Run(FrmMain) End Sub End Class In another form I use the following code:
10
22378
by: =?Utf-8?B?UmljaGFyZCBCeXNvdXRo?= | last post by:
Hi In my app I have a SplashScreen, a login form and a main form. On launching the app, I'd like to show the SplashScreen while reading config files and attempting a database connection. I show progress of these tasks on a label on the SplashScreen form. Once this is completed ok, the splash screen should close and the login form should be displayed. A successful login closes that form and shows the main form.
0
9645
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...
1
10091
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
9950
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
8972
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...
1
7499
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.