User defined Dialog : 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. 2. User defined Dialog
User defined Dialog
 


Imports System.Windows.Forms

public class UseDefineDialog
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If Disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(Disposing)
    End Sub
    Private WithEvents btnNewCaption As System.Windows.Forms.Button

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

    '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.btnNewCaption = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'btnNewCaption
        '
        Me.btnNewCaption.Location = New System.Drawing.Point(106120)
        Me.btnNewCaption.Name = "btnNewCaption"
        Me.btnNewCaption.Size = New System.Drawing.Size(8032)
        Me.btnNewCaption.TabIndex = 0
        Me.btnNewCaption.Text = "New Caption"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(292273)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnNewCaption})
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnNewCaption_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles btnNewCaption.Click
        Dim frmCaption As New Form2()
        frmCaption.ShowDialog()
        If frmCaption.DialogResult = DialogResult.OK Then
            Me.Text = frmCaption.Caption
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgsHandles MyBase.Load
        
    End Sub
End Class




Public Class Form2
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If Disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(Disposing)
    End Sub
    Private WithEvents btnOK As System.Windows.Forms.Button
    Private WithEvents btnCancel As System.Windows.Forms.Button
    Private WithEvents txtNewCaption As System.Windows.Forms.TextBox

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

    '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.DebuggerStepThroughAttribute()Private Sub InitializeComponent()
        Me.btnCancel = New System.Windows.Forms.Button()
        Me.txtNewCaption = New System.Windows.Forms.TextBox()
        Me.btnOK = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'btnCancel
        '
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Location = New System.Drawing.Point(14180)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(7232)
        Me.btnCancel.TabIndex = 2
        Me.btnCancel.Text = "Cancel"
        '
        'txtNewCaption
        '
        Me.txtNewCaption.Location = New System.Drawing.Point(7332)
        Me.txtNewCaption.Name = "txtNewCaption"
        Me.txtNewCaption.Size = New System.Drawing.Size(12020)
        Me.txtNewCaption.TabIndex = 1
        Me.txtNewCaption.Text = ""
        '
        'btnOK
        '
        Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.btnOK.Location = New System.Drawing.Point(5380)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.Size = New System.Drawing.Size(7232)
        Me.btnOK.TabIndex = 0
        Me.btnOK.Text = "OK"
        '
        'Form2
        '
        Me.AcceptButton = Me.btnOK
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(266154)
        Me.ControlBox = False
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnCancel, Me.txtNewCaption, Me.btnOK})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Name = "Form2"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Dialog"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public Property Caption() As String
        Get
            Caption = txtNewCaption.Text
        End Get
        Set(ByVal Value As String)

        End Set
    End Property


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
ww__w.___j_a__va___2s_.com___ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.