[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Use a Windows Form as a Function

Posted on 2006-11-03
2
Medium Priority
?
220 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

656 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