?
Solved

Custom DialogResult

Posted on 2006-06-13
3
Medium Priority
?
832 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

Industry Leaders: 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

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
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…
Suggested Courses

649 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