473,405 Members | 2,349 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,405 software developers and data experts.

simple: Keep ShowDialog Form from closing on AcceptButton

All,
I have login form used with ShowDialog(). I have the AcceptButton
property set so that the "Enter" key is mapped. I also need to keep the
dialog open when the UserID and PWD are invalid so user can reenter them.
How to I prevent the form from closing?

MTIA
wardeaux
Nov 21 '05 #1
2 7155
* "Wardeaux" <wa******@bellsouth.net> scripsit:
I have login form used with ShowDialog(). I have the AcceptButton
property set so that the "Enter" key is mapped. I also need to keep the
dialog open when the UserID and PWD are invalid so user can reenter them.
How to I prevent the form from closing?


Set the button's 'DialogResult' property to 'None', then add something
like the code below to the button's 'Click' event handler:

\\\
If IsValidPassword(...) Then
Me.DialogResult = DialogResult.OK
Me.Close()
Else
...
End If
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
Herfried,
many thanks!
wardeaux

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eK**************@TK2MSFTNGP10.phx.gbl...
* "Wardeaux" <wa******@bellsouth.net> scripsit:
I have login form used with ShowDialog(). I have the AcceptButton
property set so that the "Enter" key is mapped. I also need to keep the
dialog open when the UserID and PWD are invalid so user can reenter them. How to I prevent the form from closing?


Set the button's 'DialogResult' property to 'None', then add something
like the code below to the button's 'Click' event handler:

\\\
If IsValidPassword(...) Then
Me.DialogResult = DialogResult.OK
Me.Close()
Else
...
End If
///

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

Nov 21 '05 #3

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

Similar topics

2
by: Daniel | last post by:
what do you have to do in a C# dialog so that it returns to ShowDialog as DialogResult.OK ?
5
by: Josh Golden | last post by:
3 forms. form 1, when button clicked instantiates form 2 which opens but is not shown. form 2 instantiates form 3 as showdialog. form 3 finishes, raises an event that form 2 catches. during the...
1
by: No Sheds | last post by:
Hi I have an MDI application. I have a MDI child window within this application that shows another form using ShowDialog. This works fine, except that the final form shown with ShowDialog...
1
by: Jeff | last post by:
Hello all. I'm trying to figure out exactly what is going on here. I'm getting different results on different forms, and it's driving me nuts. For example, I have a form called FormFinish....
1
by: Dachshund Digital | last post by:
Can some one recreate this issue? Create WindowApplication Using .NET 2.0/Visual Studio Express VB Button on Main Form to open 2nd Form as ShowDialog Button on 2nd Form to open 3rd Form as...
2
by: **Developer** | last post by:
I have a little more info about this problem I can't seem to solve! I know it'll take a minute to study the lising but if you like to sove puzzles there is one there. I have a Form (FV&C)...
2
by: Barney | last post by:
Hi, This is my first query in google groups. I expect to don´t do it wrong, and excuse me for my english, i haven´t used it for years... I´m making a user component that inherits from a textbox....
11
by: osmarjunior | last post by:
I have a sequence of commands like this: Form1 frm = new Form1(); frm.LoadData(); Boolean confirm = (frm.ShowDialog() == DialogResult.OK); The LoadData method loads information from...
6
by: NVergunst | last post by:
I have a main form, then this form spawns another form (Form A) as a form.showdialog(). That dialog box then has a button that spawns another form (Form B) through the form.showdialog(). All of this...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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,...
0
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...

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.