練習用です。いろんなものがごちゃまぜです。
| @@ -0,0 +1,73 @@ | ||
| 1 | +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ | |
| 2 | +Partial Class Form3 | |
| 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.TextBox1 = New System.Windows.Forms.TextBox() | |
| 28 | + Me.SuspendLayout() | |
| 29 | + ' | |
| 30 | + 'Button1 | |
| 31 | + ' | |
| 32 | + Me.Button1.Location = New System.Drawing.Point(12, 12) | |
| 33 | + Me.Button1.Name = "Button1" | |
| 34 | + Me.Button1.Size = New System.Drawing.Size(75, 23) | |
| 35 | + Me.Button1.TabIndex = 0 | |
| 36 | + Me.Button1.Text = "Button1" | |
| 37 | + Me.Button1.UseVisualStyleBackColor = True | |
| 38 | + ' | |
| 39 | + 'ListBox1 | |
| 40 | + ' | |
| 41 | + Me.ListBox1.FormattingEnabled = True | |
| 42 | + Me.ListBox1.ItemHeight = 15 | |
| 43 | + Me.ListBox1.Location = New System.Drawing.Point(12, 41) | |
| 44 | + Me.ListBox1.Name = "ListBox1" | |
| 45 | + Me.ListBox1.Size = New System.Drawing.Size(258, 199) | |
| 46 | + Me.ListBox1.TabIndex = 1 | |
| 47 | + ' | |
| 48 | + 'TextBox1 | |
| 49 | + ' | |
| 50 | + Me.TextBox1.Location = New System.Drawing.Point(122, 12) | |
| 51 | + Me.TextBox1.Name = "TextBox1" | |
| 52 | + Me.TextBox1.Size = New System.Drawing.Size(100, 22) | |
| 53 | + Me.TextBox1.TabIndex = 2 | |
| 54 | + ' | |
| 55 | + 'Form3 | |
| 56 | + ' | |
| 57 | + Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!) | |
| 58 | + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font | |
| 59 | + Me.ClientSize = New System.Drawing.Size(282, 253) | |
| 60 | + Me.Controls.Add(Me.TextBox1) | |
| 61 | + Me.Controls.Add(Me.ListBox1) | |
| 62 | + Me.Controls.Add(Me.Button1) | |
| 63 | + Me.Name = "Form3" | |
| 64 | + Me.Text = "Form3" | |
| 65 | + Me.ResumeLayout(False) | |
| 66 | + Me.PerformLayout() | |
| 67 | + | |
| 68 | + End Sub | |
| 69 | + | |
| 70 | + Friend WithEvents Button1 As Button | |
| 71 | + Friend WithEvents ListBox1 As ListBox | |
| 72 | + Friend WithEvents TextBox1 As TextBox | |
| 73 | +End Class |
| @@ -0,0 +1,22 @@ | ||
| 1 | +Imports System.Globalization | |
| 2 | + | |
| 3 | +Public Class Form3 | |
| 4 | + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click | |
| 5 | + Dim dt As New StringInfo(TextBox1.Text) | |
| 6 | + Dim num As Integer | |
| 7 | + num = dt.LengthInTextElements | |
| 8 | + | |
| 9 | + If num <> 1 Then | |
| 10 | + ListBox1.Items.Add("1文字で入力してください。") | |
| 11 | + ListBox1.Items.Add($"入力した文字数は{num}文字です。") | |
| 12 | + Else | |
| 13 | + ListBox1.Items.Add($"入力した文字は'{dt.String}'です。") | |
| 14 | + ListBox1.Items.Add($"入力した文字数は{num}文字です。") | |
| 15 | + End If | |
| 16 | + ListBox1.Items.Add("") | |
| 17 | + For Each c In dt.String | |
| 18 | + Dim v = Convert.ToUInt16(c) | |
| 19 | + ListBox1.Items.Add($"{v:X4}") | |
| 20 | + Next | |
| 21 | + End Sub | |
| 22 | +End Class | |
| \ No newline at end of file |
| @@ -48,11 +48,11 @@ | ||
| 48 | 48 | ' |
| 49 | 49 | 'Button3 |
| 50 | 50 | ' |
| 51 | - Me.Button3.Location = New System.Drawing.Point(59, 120) | |
| 51 | + Me.Button3.Location = New System.Drawing.Point(26, 80) | |
| 52 | 52 | Me.Button3.Name = "Button3" |
| 53 | - Me.Button3.Size = New System.Drawing.Size(75, 23) | |
| 53 | + Me.Button3.Size = New System.Drawing.Size(157, 23) | |
| 54 | 54 | Me.Button3.TabIndex = 0 |
| 55 | - Me.Button3.Text = "Button1" | |
| 55 | + Me.Button3.Text = "1文字は何バイト" | |
| 56 | 56 | Me.Button3.UseVisualStyleBackColor = True |
| 57 | 57 | ' |
| 58 | 58 | 'Button4 |
| @@ -6,4 +6,8 @@ | ||
| 6 | 6 | Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click |
| 7 | 7 | Form2.Show() |
| 8 | 8 | End Sub |
| 9 | + | |
| 10 | + Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click | |
| 11 | + Form3.Show() | |
| 12 | + End Sub | |
| 9 | 13 | End Class |
| \ No newline at end of file |