Get Custom dialog returning value : Custom Dialog « GUI « VB.Net Tutorial

VB.Net Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statements
5. Date Time
6. Class Module
7. Development
8. Collections
9. Generics
10. Attributes
11. Event
12. Stream File
13. GUI
14. GUI Applications
15. 2D Graphics
16. I18N Internationlization
17. Reflection
18. Regular Expressions
19. Security
20. Socket Network
21. Thread
22. Windows
23. XML
24. Database ADO.net
25. Design Patterns
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial » GUI » Custom Dialog 
13. 68. 3. Get Custom dialog returning value
Get Custom dialog returning value
 

Imports System.ComponentModel
Imports System.Windows.Forms

public class CustomDialogEmployee
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class
Public Class Form1

    Private Sub btnShowDialog_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles btnShowDialog.Click
        Dim dlg As New dlgEmployee
        
        If dlg.ShowDialog() = Windows.Forms.DialogResult.OK Then
            MessageBox.Show_
                dlg.txtFirstName.Text & " " & _
                dlg.txtLastName.Text)
        Else
            MessageBox.Show("Canceled")
        End If
    End Sub
End Class
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Public Class Form1
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.btnShowDialog = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'btnShowDialog
        '
        Me.btnShowDialog.Location = New System.Drawing.Point(5632)
        Me.btnShowDialog.Name = "btnShowDialog"
        Me.btnShowDialog.Size = New System.Drawing.Size(8023)
        Me.btnShowDialog.TabIndex = 1
        Me.btnShowDialog.Text = "Show Dialog"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(19993)
        Me.Controls.Add(Me.btnShowDialog)
        Me.Name = "Form1"
        Me.Text = "CustomDialog"
        Me.ResumeLayout(False)

    End Sub
    Friend WithEvents btnShowDialog As System.Windows.Forms.Button

End Class

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Public Class dlgEmployee
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.txtLastName = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.btnCancel = New System.Windows.Forms.Button
        Me.btnOk = New System.Windows.Forms.Button
        Me.txtFirstName = New System.Windows.Forms.TextBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.SuspendLayout()
        '
        'txtLastName
        '
        Me.txtLastName.Location = New System.Drawing.Point(7233)
        Me.txtLastName.Name = "txtLastName"
        Me.txtLastName.Size = New System.Drawing.Size(16820)
        Me.txtLastName.TabIndex = 7
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(833)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(5813)
        Me.Label2.TabIndex = 10
        Me.Label2.Text = "Last Name"
        '
        'btnCancel
        '
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Location = New System.Drawing.Point(25649)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(5624)
        Me.btnCancel.TabIndex = 9
        Me.btnCancel.Text = "Cancel"
        '
        'btnOk
        '
        Me.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.btnOk.Location = New System.Drawing.Point(2569)
        Me.btnOk.Name = "btnOk"
        Me.btnOk.Size = New System.Drawing.Size(5624)
        Me.btnOk.TabIndex = 8
        Me.btnOk.Text = "OK"
        '
        'txtFirstName
        '
        Me.txtFirstName.Location = New System.Drawing.Point(729)
        Me.txtFirstName.Name = "txtFirstName"
        Me.txtFirstName.Size = New System.Drawing.Size(16820)
        Me.txtFirstName.TabIndex = 5
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(89)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(5713)
        Me.Label1.TabIndex = 6
        Me.Label1.Text = "First Name"
        '
        'dlgEmployee
        '
        Me.AcceptButton = Me.btnOk
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.CancelButton = Me.btnOk
        Me.ClientSize = New System.Drawing.Size(32082)
        Me.Controls.Add(Me.txtLastName)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnOk)
        Me.Controls.Add(Me.txtFirstName)
        Me.Controls.Add(Me.Label1)
        Me.Name = "dlgEmployee"
        Me.Text = "Enter Value"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents txtLastName As System.Windows.Forms.TextBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents btnOk As System.Windows.Forms.Button
    Friend WithEvents txtFirstName As System.Windows.Forms.TextBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
End Class

        
13. 68. Custom Dialog
13. 68. 1. Create Dialog from FormCreate Dialog from Form
13. 68. 2. User defined DialogUser defined Dialog
13. 68. 3. Get Custom dialog returning valueGet Custom dialog returning value
13. 68. 4. Login DialogLogin Dialog
13. 68. 5. About DialogAbout Dialog
13. 68. 6. Dialog apply methodDialog apply method
13. 68. 7. Custom dialog with custom classCustom dialog with custom class
13. 68. 8. Dialog with propertiesDialog with properties
www.___ja__v___a_2_s__._c_o__m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.