472,794 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 software developers and data experts.

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 4401
"DraguVaso" <pi**********@hotmail.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.showdialog = 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**********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.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**********@hotmail.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%23xQOutWDHA.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
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...
20
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...
3
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,...
0
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. ...
5
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. ...
2
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...
23
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
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...
9
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.