練習用です。いろんなものがごちゃまぜです。
| @@ -30,6 +30,7 @@ | ||
| 30 | 30 | Me.Button6 = New System.Windows.Forms.Button() |
| 31 | 31 | Me.Button7 = New System.Windows.Forms.Button() |
| 32 | 32 | Me.Button8 = New System.Windows.Forms.Button() |
| 33 | + Me.Button9 = New System.Windows.Forms.Button() | |
| 33 | 34 | Me.SuspendLayout() |
| 34 | 35 | ' |
| 35 | 36 | 'Button1 |
| @@ -101,14 +102,24 @@ | ||
| 101 | 102 | Me.Button8.Name = "Button8" |
| 102 | 103 | Me.Button8.Size = New System.Drawing.Size(157, 23) |
| 103 | 104 | Me.Button8.TabIndex = 0 |
| 104 | - Me.Button8.Text = "Button1" | |
| 105 | + Me.Button8.Text = "Finaly" | |
| 105 | 106 | Me.Button8.UseVisualStyleBackColor = True |
| 106 | 107 | ' |
| 108 | + 'Button9 | |
| 109 | + ' | |
| 110 | + Me.Button9.Location = New System.Drawing.Point(189, 22) | |
| 111 | + Me.Button9.Name = "Button9" | |
| 112 | + Me.Button9.Size = New System.Drawing.Size(157, 23) | |
| 113 | + Me.Button9.TabIndex = 0 | |
| 114 | + Me.Button9.Text = "Button1" | |
| 115 | + Me.Button9.UseVisualStyleBackColor = True | |
| 116 | + ' | |
| 107 | 117 | 'frmMenu |
| 108 | 118 | ' |
| 109 | 119 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!) |
| 110 | 120 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font |
| 111 | 121 | Me.ClientSize = New System.Drawing.Size(747, 253) |
| 122 | + Me.Controls.Add(Me.Button9) | |
| 112 | 123 | Me.Controls.Add(Me.Button8) |
| 113 | 124 | Me.Controls.Add(Me.Button7) |
| 114 | 125 | Me.Controls.Add(Me.Button6) |
| @@ -131,4 +142,5 @@ | ||
| 131 | 142 | Friend WithEvents Button6 As Button |
| 132 | 143 | Friend WithEvents Button7 As Button |
| 133 | 144 | Friend WithEvents Button8 As Button |
| 145 | + Friend WithEvents Button9 As Button | |
| 134 | 146 | End Class |
| @@ -26,4 +26,8 @@ | ||
| 26 | 26 | Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click |
| 27 | 27 | Form7.Show() |
| 28 | 28 | End Sub |
| 29 | + | |
| 30 | + Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click | |
| 31 | + Form8.Show() | |
| 32 | + End Sub | |
| 29 | 33 | End Class |
| \ No newline at end of file |
| @@ -0,0 +1,50 @@ | ||
| 1 | +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ | |
| 2 | +Partial Class Form8 | |
| 3 | + Inherits System.Windows.Forms.Form | |
| 4 | + | |
| 5 | + 'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。 | |
| 6 | + <System.Diagnostics.DebuggerNonUserCode()> _ | |
| 7 | + Protected Overrides Sub Dispose(ByVal disposing As Boolean) | |
| 8 | + Try | |
| 9 | + If disposing AndAlso components IsNot Nothing Then | |
| 10 | + components.Dispose() | |
| 11 | + End If | |
| 12 | + Finally | |
| 13 | + MyBase.Dispose(disposing) | |
| 14 | + End Try | |
| 15 | + End Sub | |
| 16 | + | |
| 17 | + 'Windows フォーム デザイナーで必要です。 | |
| 18 | + Private components As System.ComponentModel.IContainer | |
| 19 | + | |
| 20 | + 'メモ: 以下のプロシージャは Windows フォーム デザイナーで必要です。 | |
| 21 | + 'Windows フォーム デザイナーを使用して変更できます。 | |
| 22 | + 'コード エディターを使って変更しないでください。 | |
| 23 | + <System.Diagnostics.DebuggerStepThrough()> _ | |
| 24 | + Private Sub InitializeComponent() | |
| 25 | + Me.Button1 = New System.Windows.Forms.Button() | |
| 26 | + Me.SuspendLayout() | |
| 27 | + ' | |
| 28 | + 'Button1 | |
| 29 | + ' | |
| 30 | + Me.Button1.Location = New System.Drawing.Point(90, 93) | |
| 31 | + Me.Button1.Name = "Button1" | |
| 32 | + Me.Button1.Size = New System.Drawing.Size(75, 23) | |
| 33 | + Me.Button1.TabIndex = 0 | |
| 34 | + Me.Button1.Text = "Button1" | |
| 35 | + Me.Button1.UseVisualStyleBackColor = True | |
| 36 | + ' | |
| 37 | + 'Form8 | |
| 38 | + ' | |
| 39 | + Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!) | |
| 40 | + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font | |
| 41 | + Me.ClientSize = New System.Drawing.Size(282, 253) | |
| 42 | + Me.Controls.Add(Me.Button1) | |
| 43 | + Me.Name = "Form8" | |
| 44 | + Me.Text = "Form8" | |
| 45 | + Me.ResumeLayout(False) | |
| 46 | + | |
| 47 | + End Sub | |
| 48 | + | |
| 49 | + Friend WithEvents Button1 As Button | |
| 50 | +End Class |
| @@ -0,0 +1,48 @@ | ||
| 1 | +Public Class Form8 | |
| 2 | + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click | |
| 3 | + Try | |
| 4 | + Prepare() | |
| 5 | + ProcA() | |
| 6 | + If Func1() Then Return | |
| 7 | + ProcB() | |
| 8 | + Catch ex As Exception | |
| 9 | + PrintLogA() | |
| 10 | + If Func2() Then Return | |
| 11 | + PrintLogB() | |
| 12 | + Finally | |
| 13 | + Finish() | |
| 14 | + End Try | |
| 15 | + End Sub | |
| 16 | + | |
| 17 | + Private Sub Prepare() | |
| 18 | + | |
| 19 | + End Sub | |
| 20 | + | |
| 21 | + Private Sub ProcA() | |
| 22 | + | |
| 23 | + End Sub | |
| 24 | + | |
| 25 | + Private Function Func1() As Boolean | |
| 26 | + Return True | |
| 27 | + End Function | |
| 28 | + | |
| 29 | + Private Sub ProcB() | |
| 30 | + Throw New Exception() | |
| 31 | + End Sub | |
| 32 | + | |
| 33 | + Private Sub PrintLogA() | |
| 34 | + | |
| 35 | + End Sub | |
| 36 | + | |
| 37 | + Private Function Func2() As Boolean | |
| 38 | + Return True | |
| 39 | + End Function | |
| 40 | + | |
| 41 | + Private Sub PrintLogB() | |
| 42 | + | |
| 43 | + End Sub | |
| 44 | + | |
| 45 | + Private Sub Finish() | |
| 46 | + MessageBox.Show("Finish") | |
| 47 | + End Sub | |
| 48 | +End Class | |
| \ No newline at end of file |