How to redirect page in windows application?

  • Thread starter Thread starter JenHu
  • Start date Start date
J

JenHu

Hi all,

I have to ask a stupid question:

In asp.net, I use Response.Redirect ("Main.aspx") to redirect pages,
but what is the syntax of redirect forms in vb.net windows
application?

I have a login page, after clicked "login", it will direct the page to
main.vb, but error says "response is not declared".......
Thanks.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
The best route to go with logins is to use your main.vb to instantiate an instance of
"Login" ,
do your validation in the login.vb, then return control to main.vb like so....

'in the load event of Main.vb
dim x as new login
x.showdialog()

<showdialog forces you to be close the form before it returns control>
x.show() will work too, but the form isn't modal




| Hi all,
|
| I have to ask a stupid question:
|
| In asp.net, I use Response.Redirect ("Main.aspx") to redirect pages,
| but what is the syntax of redirect forms in vb.net windows
| application?
|
| I have a login page, after clicked "login", it will direct the page to
| main.vb, but error says "response is not declared".......
| Thanks.
|
| *-----------------------*
| Posted at:
| www.GroupSrv.com
| *-----------------------*
 
JenHu said:
In asp.net, I use Response.Redirect ("Main.aspx") to redirect pages,
but what is the syntax of redirect forms in vb.net windows
application?

I have a login page, after clicked "login", it will direct the page to
main.vb, but error says "response is not declared".......

\\\
Dim MainForm As New MainForm()
MainForm.Show()
///
 
As Herfried and Clamps indicate, switching between WinForms is completely
different than between WebForms. WinForms doesn't use the response object.
Instead, you instantiate an instance of your form, and then use one of the
show methods on it.

You could either have your main form create and show the login form before
the main form shows, or have your login form create and show your main form
in its OK button's event if the login is successful.

Hope that helps,
Brian
 
JenHu,

You have answers from Clamps and Herfried,

What Herfried does not tell is that he is using a C# methode to instance his
forms.
He has with every project a class "main" where he starts his forms from.

Clamps starts his loginform in the loadevent from his mainform (the same as
I do). In the load event from the mainform is the mainform still not showed.
Therefore the users sees only a login and can not do anything else than
enter the values. When wrong you cancel (me.close in the mainform) and he
sees nothing.

Just as addition I hope this helps?

Cor
 
Cor Ligthert said:
You have answers from Clamps and Herfried,

What Herfried does not tell is that he is using a C# methode to instance
his forms.

Huh?! I am definitely /not/ using a C# method.
 
Hit
Huh?! I am definitely /not/ using a C# method.
That module method you use is in my opinion almost the same as in C#

I had fun to write it this way.

Cor
 
Where did I use a module in my sample?

Is this enough

http://tinyurl.com/6hbh3

:)))

(I was not talking about your sample by the way, I told that the way your
starts your project leads to your sample)

Cor
 
Cor Ligthert said:
Is this enough

http://tinyurl.com/6hbh3

:)))

(I was not talking about your sample by the way, I told that the way your
starts your project leads to your sample)

How would you start your program if you have to do certain things before
showing a form?!
 
Herfried,

?????
How would you start your program if you have to do certain things before
showing a form?!

As I wrote in this thread, and you have written it yourself so often.

Cor
 
Cor,

Cor Ligthert said:
As I wrote in this thread, and you have written it yourself so often.


I feel sorry, but I don't understand what you want to tell me...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top