練習用です。いろんなものがごちゃまぜです。
| @@ -0,0 +1,62 @@ | ||
| 1 | +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ | |
| 2 | +Partial Class Form6 | |
| 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.ListBox1 = New System.Windows.Forms.ListBox() | |
| 27 | + Me.SuspendLayout() | |
| 28 | + ' | |
| 29 | + 'Button1 | |
| 30 | + ' | |
| 31 | + Me.Button1.Location = New System.Drawing.Point(75, 25) | |
| 32 | + Me.Button1.Name = "Button1" | |
| 33 | + Me.Button1.Size = New System.Drawing.Size(75, 23) | |
| 34 | + Me.Button1.TabIndex = 0 | |
| 35 | + Me.Button1.Text = "Button1" | |
| 36 | + Me.Button1.UseVisualStyleBackColor = True | |
| 37 | + ' | |
| 38 | + 'ListBox1 | |
| 39 | + ' | |
| 40 | + Me.ListBox1.FormattingEnabled = True | |
| 41 | + Me.ListBox1.ItemHeight = 15 | |
| 42 | + Me.ListBox1.Location = New System.Drawing.Point(56, 78) | |
| 43 | + Me.ListBox1.Name = "ListBox1" | |
| 44 | + Me.ListBox1.Size = New System.Drawing.Size(120, 94) | |
| 45 | + Me.ListBox1.TabIndex = 1 | |
| 46 | + ' | |
| 47 | + 'Form6 | |
| 48 | + ' | |
| 49 | + Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!) | |
| 50 | + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font | |
| 51 | + Me.ClientSize = New System.Drawing.Size(282, 253) | |
| 52 | + Me.Controls.Add(Me.ListBox1) | |
| 53 | + Me.Controls.Add(Me.Button1) | |
| 54 | + Me.Name = "Form6" | |
| 55 | + Me.Text = "Form6" | |
| 56 | + Me.ResumeLayout(False) | |
| 57 | + | |
| 58 | + End Sub | |
| 59 | + | |
| 60 | + Friend WithEvents Button1 As Button | |
| 61 | + Friend WithEvents ListBox1 As ListBox | |
| 62 | +End Class |
| @@ -0,0 +1,9 @@ | ||
| 1 | +Public Class Form6 | |
| 2 | + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click | |
| 3 | + Dim m As New MyCollection | |
| 4 | + | |
| 5 | + For Each c In m | |
| 6 | + ListBox1.Items.Add(c) | |
| 7 | + Next | |
| 8 | + End Sub | |
| 9 | +End Class | |
| \ No newline at end of file |
| @@ -0,0 +1,33 @@ | ||
| 1 | +Public Class MyCollection | |
| 2 | + Implements IEnumerable | |
| 3 | + | |
| 4 | + Public Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator | |
| 5 | + Return New MyEnumerator | |
| 6 | + End Function | |
| 7 | + | |
| 8 | +End Class | |
| 9 | + | |
| 10 | +Public Class MyEnumerator | |
| 11 | + Implements IEnumerator | |
| 12 | + | |
| 13 | + Private myCursor As Integer = 0 | |
| 14 | + | |
| 15 | + Public ReadOnly Property Current As Object Implements IEnumerator.Current | |
| 16 | + Get | |
| 17 | + Return myCursor * 2 | |
| 18 | + End Get | |
| 19 | + End Property | |
| 20 | + | |
| 21 | + Public Sub Reset() Implements IEnumerator.Reset | |
| 22 | + myCursor = 0 | |
| 23 | + End Sub | |
| 24 | + | |
| 25 | + Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext | |
| 26 | + If myCursor < 5 Then | |
| 27 | + myCursor += 1 | |
| 28 | + Return True | |
| 29 | + Else | |
| 30 | + Return False | |
| 31 | + End If | |
| 32 | + End Function | |
| 33 | +End Class | |
| \ No newline at end of file |
| @@ -28,6 +28,7 @@ | ||
| 28 | 28 | Me.Button4 = New System.Windows.Forms.Button() |
| 29 | 29 | Me.Button5 = New System.Windows.Forms.Button() |
| 30 | 30 | Me.Button6 = New System.Windows.Forms.Button() |
| 31 | + Me.Button7 = New System.Windows.Forms.Button() | |
| 31 | 32 | Me.SuspendLayout() |
| 32 | 33 | ' |
| 33 | 34 | 'Button1 |
| @@ -81,14 +82,24 @@ | ||
| 81 | 82 | Me.Button6.Name = "Button6" |
| 82 | 83 | Me.Button6.Size = New System.Drawing.Size(157, 23) |
| 83 | 84 | Me.Button6.TabIndex = 0 |
| 84 | - Me.Button6.Text = "Button1" | |
| 85 | + Me.Button6.Text = "MyCollection" | |
| 85 | 86 | Me.Button6.UseVisualStyleBackColor = True |
| 86 | 87 | ' |
| 88 | + 'Button7 | |
| 89 | + ' | |
| 90 | + Me.Button7.Location = New System.Drawing.Point(26, 196) | |
| 91 | + Me.Button7.Name = "Button7" | |
| 92 | + Me.Button7.Size = New System.Drawing.Size(157, 23) | |
| 93 | + Me.Button7.TabIndex = 0 | |
| 94 | + Me.Button7.Text = "Button1" | |
| 95 | + Me.Button7.UseVisualStyleBackColor = True | |
| 96 | + ' | |
| 87 | 97 | 'frmMenu |
| 88 | 98 | ' |
| 89 | 99 | Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!) |
| 90 | 100 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font |
| 91 | 101 | Me.ClientSize = New System.Drawing.Size(747, 253) |
| 102 | + Me.Controls.Add(Me.Button7) | |
| 92 | 103 | Me.Controls.Add(Me.Button6) |
| 93 | 104 | Me.Controls.Add(Me.Button5) |
| 94 | 105 | Me.Controls.Add(Me.Button4) |
| @@ -107,4 +118,5 @@ | ||
| 107 | 118 | Friend WithEvents Button4 As Button |
| 108 | 119 | Friend WithEvents Button5 As Button |
| 109 | 120 | Friend WithEvents Button6 As Button |
| 121 | + Friend WithEvents Button7 As Button | |
| 110 | 122 | End Class |
| @@ -18,4 +18,8 @@ | ||
| 18 | 18 | Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click |
| 19 | 19 | Form5.Show() |
| 20 | 20 | End Sub |
| 21 | + | |
| 22 | + Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click | |
| 23 | + Form6.Show() | |
| 24 | + End Sub | |
| 21 | 25 | End Class |
| \ No newline at end of file |