473,725 Members | 2,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

easy (??) question: Open New Form and Close Current Form

Hi,

I want a Login-form that, once the username and password are validated,
opens a new Form (of the 'main'-application), and closes itself.

I tryed it like this: putting the following code in the click-event of the
login-button of my Login-form:
Dim frmAG As New frmAgent
frmAG.Show()
Me.Close()

Thios opens the new form (frmAgent), but at the "Me.Close" it not only
closes my login-form, but also the new openend frmAgent!

Does anybody knows how I'm able to open the frmAgent and close the
login-form? I guess this msut be very easy but I'm not abvle to find it :-/

Thanks a lot!

Pieter


Nov 20 '05 #1
4 4451
"DraguVaso" <pi**********@h otmail.com> schrieb
Hi,

I want a Login-form that, once the username and password are
validated, opens a new Form (of the 'main'-application), and closes
itself.

I tryed it like this: putting the following code in the click-event
of the login-button of my Login-form:
Dim frmAG As New frmAgent
frmAG.Show()
Me.Close()

Thios opens the new form (frmAgent), but at the "Me.Close" it not
only closes my login-form, but also the new openend frmAgent!

Does anybody knows how I'm able to open the frmAgent and close the
login-form? I guess this msut be very easy but I'm not abvle to find
it :-/


sub main
dim login as new loginform
if login.showdialo g = ok then
application.run (new frmAgent)
end if
end sub

Put the sub in a module and set it as the startup object. Or put it in a
class and add "shared" in front of the "sub" keyword.

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Hi Pieter,

Why not the normal way where a main form shows a new dialogform and goes on
when that closes with an OK or closes the application when it is Cancel?

Cor
Nov 20 '05 #3
I believe that the TaskVision application does something similar at startup.
You may want to look at the source for this solution to see how it's
handled.
http://windowsforms.net/Default.aspx...dex=6&tabid=44

--
Tim Wilson
..Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
"DraguVaso" <pi**********@h otmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Hi,

I want a Login-form that, once the username and password are validated,
opens a new Form (of the 'main'-application), and closes itself.

I tryed it like this: putting the following code in the click-event of the
login-button of my Login-form:
Dim frmAG As New frmAgent
frmAG.Show()
Me.Close()

Thios opens the new form (frmAgent), but at the "Me.Close" it not only
closes my login-form, but also the new openend frmAgent!

Does anybody knows how I'm able to open the frmAgent and close the
login-form? I guess this msut be very easy but I'm not abvle to find it :-/
Thanks a lot!

Pieter

Nov 20 '05 #4
* "DraguVaso" <pi**********@h otmail.com> scripsit:
I want a Login-form that, once the username and password are validated,
opens a new Form (of the 'main'-application), and closes itself.


<URL:http://www.google.de/groups?selm=u%2 3xQOutWDHA.2100 %40TK2MSFTNGP11 .phx.gbl>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5

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

Similar topics

4
4295
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field that has been modified/clicked the form doesn't always submit. When it does work, a Stored procedure is passed form variables and updates to the db are made. When it doesn't, its as if the form wasn't submitted, it reloads and resets the page, but...
20
2374
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File (Employees), and the other is an Address File (Addresses) linked by SSN. I've set Addresses as a Lookup Table - If the user starts typing in the SSN it should pull up the Employees records. I'm getting stuck in the Data Entry form. When I type in...
3
3823
by: Salad | last post by:
I have a form with a few command buttons. These command buttons open forms. In the OnActivate event of the main form I put in the line msgbox "Activate" When I press a button to open a form, close the opened form, I get the message "Activate"...except for one. All of the called forms have the syntax Docmd.Openform "FormName" with no arguments.
0
1165
by: Laszlo Szijarto | last post by:
I have an app which moves around between a series of forms. I don't want to keep the forms open but hidden. I need to close them as I switch back and forth from one form to another. Unfortunately, if I start up my app with Application.Run(new formLogin()), for example, as soon as the formLogin gets closed, the whole app exits. Yet, if I start up as follows: (new formLogin()).Show(); Application.Run();
5
2626
by: BethInAK | last post by:
Thank you in advance for any possible help you have to offer, before I pull my hair out! I am incredibly frustrated attempting to learn asp.net. Its really pissing me off. Please help. First, please tell me the best asp .net book to purchase for a stupid beginner, preferably with vb instead of C. I have no idea what most of the c code in my current book means and in trying to learn the .net stuff at the same time, its giving me...
2
1623
by: Bert Szoghy | last post by:
Hello, I am missing something about Visual Basic .NET module variables and window close events. In the following code, after opening Form2 by clicking a button on Form1 and then closing Form2, I would expect to click on the second Form1 button and get intMyValue = 0. Form2 has code to reinitialize it in its close event, but this doesn't seem
23
2429
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
3
3008
by: godhulirbalaka | last post by:
Dear Sir/Madam, I am new vb 6.0 user. I am developing Shop Management Program. I have a main form with buttons and menus. when i click any button then respective form is open. I want to set a command by which when i click a button then respective form will open and when i click another button then previous opened form will close and new form will open. that means at a time only one form will active with the main form. Please note that i dont...
9
1802
by: Scott Stark | last post by:
Hello, I'm *just* delving into Windows forms-based programming without the benefit of any books, etc. I have a background in light ASP.NET work, so forgive me if this is a really basic question related to Windows GUI. I've created a "Form1.vb" file in my project, added a menustrip, etc. When a user clicks on a menu item, how do I get it to show a new form in the same window?
0
8889
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
8752
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
9257
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
9179
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
9116
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
8099
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
6011
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
4519
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...
0
4784
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.