?
Solved

Use a Windows Form as a Function

Posted on 2006-11-03
2
Medium Priority
?
216 Views
Last Modified: 2010-04-23
I have a login form I will be using a few times in my app.

How do i call this form like a function.  So the form is displayed and allow the use to confirm their login and when the form is closed it returns true or false.
0
Comment
Question by:Kevin Robinson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 2000 total points
ID: 17867945
You can show the form modally and then receive a DialogResult (which can be specified inside the login form) as a returned result.  Here's an example:

'Create the login form
Dim frmLogin As New LoginForm
Dim dlgResult As DialogResult = frmLogin.ShowDialog()

If dlgResult = DialogResult.Yes Then
      'Login successful
ElseIf dlgResult = DialogResult.No Then
      'Login failed
End If

--------------------
Inside the login form, you can set the result that will be returned like this:

                  Me.DialogResult = DialogResult.Yes

0
 
LVL 11

Expert Comment

by:melmers
ID: 17867951
In your Main form declare a public shared function where you display your form.
In all other forms call your shared function
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question