473,386 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Pop-up login dialog box

Hello,

I am programming in Visual Basic .NET. I have seen examples of creating a
login form to use for users to type in their username and password, but I
want to accomplish the same thing with a pop-up dialog box instead. How can
I make my program bring up a pop-up login dialog box for a user to type in
username and password?

Thanks,
Dusty

Nov 29 '05 #1
18 13487
You can call a login form as a dialog box with the following code:

Dim frmNewDownload As New frmDownload
frmNewDownload.ShowDialog()

That will give your users a dialog box but still allow you to design the
form to your specs.

Curtis

"Dusty Hackney" <Dusty Ha*****@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
Hello,

I am programming in Visual Basic .NET. I have seen examples of creating a
login form to use for users to type in their username and password, but I
want to accomplish the same thing with a pop-up dialog box instead. How
can
I make my program bring up a pop-up login dialog box for a user to type in
username and password?

Thanks,
Dusty

Nov 29 '05 #2
"Dusty Hackney" <Dusty Ha*****@discussions.microsoft.com> schrieb:
I am programming in Visual Basic .NET. I have seen examples of creating a
login form to use for users to type in their username and password, but I
want to accomplish the same thing with a pop-up dialog box instead. How
can
I make my program bring up a pop-up login dialog box for a user to type in
username and password?


If you are using VS 2005:

Select "Project" -> "Add new item..." -> "Login Form" -> "Add". Then use
the following code to display the login dialog:

\\\
Using f As New LoginForm()
If f.ShowDialog = DialogResult.OK Then
Password = f.PasswordTextBox.Text
Username = f.UsernameTextBox.Text
End If
End Using
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 29 '05 #3
Herfried,

\\\
Using f As New LoginForm()
If f.ShowDialog = DialogResult.OK Then
Password = f.PasswordTextBox.Text
Username = f.UsernameTextBox.Text
End If
End Using
///

It sound strange, however normally it will not needed ot return the
password, that can be checked in the dialog itself. An Ok is more than
enough and than in the code.

If f.showdialog <> dialogresult.OK me.close

A typical question for you. How do I get rit of that error warning (shared
member) with this in VB2005?

Cor


Nov 30 '05 #4
Dusty,

Ever thought doing it without a Login, your users will be glad with you

http://msdn.microsoft.com/library/de...nroletopic.asp

Just as alternative

Cor

"Dusty Hackney" <Dusty Ha*****@discussions.microsoft.com> schreef in bericht
news:2B**********************************@microsof t.com...
Hello,

I am programming in Visual Basic .NET. I have seen examples of creating a
login form to use for users to type in their username and password, but I
want to accomplish the same thing with a pop-up dialog box instead. How
can
I make my program bring up a pop-up login dialog box for a user to type in
username and password?

Thanks,
Dusty

Nov 30 '05 #5
Cor,

"Cor Ligthert [MVP]" <no************@planet.nl> schrieb:
\\\
Using f As New LoginForm()
If f.ShowDialog = DialogResult.OK Then
Password = f.PasswordTextBox.Text
Username = f.UsernameTextBox.Text
End If
End Using
///
It sound strange, however normally it will not needed ot return the
password, that can be checked in the dialog itself. An Ok is more than
enough and than in the code.

If f.showdialog <> dialogresult.OK me.close


Mhm... So you think it's a good idea to return 'DialogResult.OK' to
represent valid login data? I do not like this idea. The value of
'DialogResult' should IMO be set by the button selected on the form.
A typical question for you. How do I get rit of that error warning (shared
member) with this in VB2005?


Where's that error warning?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 30 '05 #6
> Cor,

"Cor Ligthert [MVP]" <no************@planet.nl> schrieb:
\\\
Using f As New LoginForm()
If f.ShowDialog = DialogResult.OK Then
Password = f.PasswordTextBox.Text
Username = f.UsernameTextBox.Text
End If
End Using
///

It sound strange, however normally it will not needed ot return the
password, that can be checked in the dialog itself. An Ok is more than
enough and than in the code.

If f.showdialog <> dialogresult.OK me.close


Mhm... So you think it's a good idea to return 'DialogResult.OK' to
represent valid login data? I do not like this idea. The value of
'DialogResult' should IMO be set by the button selected on the form.

You don't need that password in your application, so why would you than get
it in that, you only need to verify that the user is a right one. (It can be
that you with this system have to transport back his/hers rights however
that is something else).
A typical question for you. How do I get rit of that error warning
(shared member) with this in VB2005?


Where's that error warning?


Sorry not an error warning, one of those that you like so much a 'warning'.
(which means not like so much)
(Access to a shared member etc)

Windows.Forms.DialogResult.OK
'gives no warning
DialogResult.OK

'gives warning

Cor


Nov 30 '05 #7
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb:
\\\
Using f As New LoginForm()
If f.ShowDialog = DialogResult.OK Then
Password = f.PasswordTextBox.Text
Username = f.UsernameTextBox.Text
End If
End Using
///

It sound strange, however normally it will not needed ot return the
password, that can be checked in the dialog itself. An Ok is more than
enough and than in the code.

If f.showdialog <> dialogresult.OK me.close


Mhm... So you think it's a good idea to return 'DialogResult.OK' to
represent valid login data? I do not like this idea. The value of
'DialogResult' should IMO be set by the button selected on the form.


You don't need that password in your application, so why would you than
get it in that, you only need to verify that the user is a right one. (It
can be that you with this system have to transport back his/hers rights
however that is something else).


This depends on the case. Maybe you need the password when establishing a
connection to a database. I would not place the database-related code
inside the login dialog.
A typical question for you. How do I get rit of that error warning
(shared member) with this in VB2005?


Where's that error warning?


Sorry not an error warning, one of those that you like so much a
'warning'. (which means not like so much)
(Access to a shared member etc)

Windows.Forms.DialogResult.OK
'gives no warning
DialogResult.OK

'gives warning


That's interesting. I currently only have the August CTP at hand, but the
code compiles just fine without a warning inside a form, althout the warning
is enabled. However, according to the IDE 'DialogResult' is resolved to the
form's property instead of the enumeration.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 30 '05 #8
Herfried,
This depends on the case. Maybe you need the password when establishing a connection to a database. I would not place the database-related code
inside the login dialog.


You get it forever from the database otherwise you can use the
IsInRoleMethod. In my opinion is the logic about the checking the best
placed in that login class (in a seperated DLL) and not spread over a kind
of main class. While you use in that login class of course the logic from
your database layer class(es).

Just my thought,

Cor
Nov 30 '05 #9
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb:
This depends on the case. Maybe you need the password when establishing
a
connection to a database. I would not place the database-related code
inside the login dialog.


You get it forever from the database otherwise you can use the
IsInRoleMethod. In my opinion is the logic about the checking the best
placed in that login class (in a seperated DLL) and not spread over a kind
of main class. While you use in that login class of course the logic from
your database layer class(es).


Yep, but the login dialog is part of the presentation layer and doesn't
belong to the data layer. And, finally you have to pass login data to the
data layer to establish the connection, for example.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 30 '05 #10
Thanks for the input; however, I am using version 2003.
"Herfried K. Wagner [MVP]" wrote:
"Dusty Hackney" <Dusty Ha*****@discussions.microsoft.com> schrieb:
I am programming in Visual Basic .NET. I have seen examples of creating a
login form to use for users to type in their username and password, but I
want to accomplish the same thing with a pop-up dialog box instead. How
can
I make my program bring up a pop-up login dialog box for a user to type in
username and password?


If you are using VS 2005:

Select "Project" -> "Add new item..." -> "Login Form" -> "Add". Then use
the following code to display the login dialog:

\\\
Using f As New LoginForm()
If f.ShowDialog = DialogResult.OK Then
Password = f.PasswordTextBox.Text
Username = f.UsernameTextBox.Text
End If
End Using
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 30 '05 #11
This seems to only work in a Windows Form. However, what I am working with
is a Web Form. Is there a way to make it work for the web form, or is there
another way in the web forms that I can accomplish this?

Thanks,
Dusty
"Curtis" wrote:
You can call a login form as a dialog box with the following code:

Dim frmNewDownload As New frmDownload
frmNewDownload.ShowDialog()

That will give your users a dialog box but still allow you to design the
form to your specs.

Curtis

"Dusty Hackney" <Dusty Ha*****@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
Hello,

I am programming in Visual Basic .NET. I have seen examples of creating a
login form to use for users to type in their username and password, but I
want to accomplish the same thing with a pop-up dialog box instead. How
can
I make my program bring up a pop-up login dialog box for a user to type in
username and password?

Thanks,
Dusty


Nov 30 '05 #12
Thanks for the input. I think that I will be able to use this for a
different project I am working on. However, I would still like to know how
to make the pop-up login box work for my current project because my boss
would like to be able to bring up a login box on-demand (perhaps even from a
button). One of the reasons he would like the pop-up box is in the instance
if one of our HR people leaves there computer unattended then someone can't
sit down and run the programs we wrote for them without knowing that HR
person's password.
"Cor Ligthert [MVP]" wrote:
Dusty,

Ever thought doing it without a Login, your users will be glad with you

http://msdn.microsoft.com/library/de...nroletopic.asp

Just as alternative

Cor

"Dusty Hackney" <Dusty Ha*****@discussions.microsoft.com> schreef in bericht
news:2B**********************************@microsof t.com...
Hello,

I am programming in Visual Basic .NET. I have seen examples of creating a
login form to use for users to type in their username and password, but I
want to accomplish the same thing with a pop-up dialog box instead. How
can
I make my program bring up a pop-up login dialog box for a user to type in
username and password?

Thanks,
Dusty


Nov 30 '05 #13
The using does in VB2005 the same as the changes I made bellow

\\\
dim f As New LoginForm()
If f.ShowDialog = DialogResult.OK Then
Password = f.PasswordTextBox.Text
Username = f.UsernameTextBox.Text
End If

f.dispose
///

That is all

I hope this helps,

Cor
Nov 30 '05 #14
Dusty,

Have a look at the complete message thread, Herfried and I had a pleasant
discussion about your problem and although we go sometimes in this newsgroup
to a sideline (and than it is a complete other problem), was this was almost
only about your problem.

Cor
Nov 30 '05 #15
Cor,

Thanks. The problem is that I am working with web forms so the ShowDialog
method isn't available. How can I accomplish this pop-up dialog when working
with web forms?

Thanks,
Dusty
"Cor Ligthert [MVP]" wrote:
Dusty,

Have a look at the complete message thread, Herfried and I had a pleasant
discussion about your problem and although we go sometimes in this newsgroup
to a sideline (and than it is a complete other problem), was this was almost
only about your problem.

Cor

Nov 30 '05 #16
"Dusty Hackney" <Du**********@discussions.microsoft.com> schrieb:
Thanks. The problem is that I am working with web forms so the ShowDialog
method isn't available. How can I accomplish this pop-up dialog when
working
with web forms?


I suggest not to use Web Page dialogs. Instead, use a login page.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 30 '05 #17
Dusty,

If you had sad that before than it would have been easier to answer you.
This newsgroup has default a windowsform, while we do as well aspnet
normally with code behind.

However, around the login with a webpage are more aspects than only the
code, which can in my opinion better be handled in the framework newsgroup
for ASPNET or a security newsgroup.

In my opinion it is better that you start asking this in this newsgroup.

microsoft.public.dotnet.framework.aspnet

I assume that if needed they tell you what security newsgroup is than the
best for your problem.

I think that you have with this much more as answer than that we start
helping you here with that,

Cor
Nov 30 '05 #18
o.k. Thanks.

"Herfried K. Wagner [MVP]" wrote:
"Dusty Hackney" <Du**********@discussions.microsoft.com> schrieb:
Thanks. The problem is that I am working with web forms so the ShowDialog
method isn't available. How can I accomplish this pop-up dialog when
working
with web forms?


I suggest not to use Web Page dialogs. Instead, use a login page.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 30 '05 #19

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

Similar topics

4
by: Roy Smith | last post by:
In the recent "transforming a list into a string" thread, we've been discussing the fact that list.pop() is O(1), but list.pop(0) is O(n). I decided to do a little timing experiment. To be sure,...
1
by: spencer | last post by:
Hi, The code. def buildStackMajor(): for node in dirStackMinor: #print 's is the node...', node dirStackMajor.append(node) dirStackMinor.pop() print 'POP the stack...', len(dirStackMinor)...
6
by: Will | last post by:
Hi, Sorry to be a pest... But I can figure this out. I'm pushing to a stack. then I need to check to see if the word is a palindrome. Is the code below correct? if so, how can I check the...
2
by: John Hoge | last post by:
I would like to open an exit pop when a user leaves my site, but I don't want to the back button to trigger the pop if the user remains in my site. I'm using the onUnload attribute of the Body...
15
by: Stig Brautaset | last post by:
Hi group, I'm playing with a little generic linked list/stack library, and have a little problem with the interface of the pop() function. If I used a struct like this it would be simple: ...
11
by: Vijay Kumar R Zanvar | last post by:
> In <pan.2004.04.22.04.06.05.969827@bar.net> "Mac" <foo@bar.net> writes: > > >Is it legal to declare errno after you've included errno.h? > > > >For example: > > > >#include<errno.h> > > >...
25
by: Nicholas Parsons | last post by:
Howdy Folks, I was just playing around in IDLE at the interactive prompt and typed in dir({}) for the fun of it. I was quite surprised to see a pop method defined there. I mean is that a...
7
by: Scott | last post by:
As said before I'm new to programming, and I need in depth explaination to understand everything the way I want to know it, call it a personality quirk ;p. With pop() you remove the last element...
4
by: j_depp_99 | last post by:
The program below fails on execution and I think the error is in my pop function but it all looks correct.Also could someone check my code as to why my print function is not working? I havent...
20
by: merrittr | last post by:
I need some C advice I want to read in string commands from a user when the user enters a \n I want to push it on the stac. Then at some point , if the user enters the word print pop off and print...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.