?
Solved

Custom DialogResult

Posted on 2006-06-13
3
Medium Priority
?
828 Views
Last Modified: 2012-08-13
is there anyway to have a custom result from a dialog?

instead of dialogresult.OK, dialogresult.cancel, etc,

could i create a custom result like DialogResult.PasswordOK?

thanks
0
Comment
Question by:newyuppie
[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
3 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 16898502
Usage:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Form1.MyShowDialog = MyResult.PasswordOK Then
            MsgBox("Password Accepted")
        Else
            MsgBox("Password Failed")
        End If
    End Sub



...and here is Form1...



Public Class Form1

    Public Enum MyResult
        PasswordOK
        PasswordInvalid
    End Enum

    Private result As Form1.MyResult

    Public ReadOnly Property MyDialogResult()
        Get
            Return result
        End Get
    End Property

    Public Shared Function MyShowDialog() As Form1.MyResult
        Dim f1 As New Form1
        f1.ControlBox = False
        f1.ShowDialog()
        Return f1.MyDialogResult
    End Function

    Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        If TextBox1.Text = "something" Then
            result = MyResult.PasswordOK
        Else
            result = MyResult.PasswordInvalid
        End If
        Me.Hide()
    End Sub

End Class
0
 
LVL 13

Author Comment

by:newyuppie
ID: 16973057
sorry for posting so late, you answered very promptly. i am checking that code right now and will award you the points if its working
0
 
LVL 13

Author Comment

by:newyuppie
ID: 16986779
idle_mind sorry for the delay i had to urgently take care of another business...

i tried the code and it does the trick for me, thank you very much for posting the full code! you get the points
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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 …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

765 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