VBでHashtable
Dim hogen As New Hashtable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim str1 As String Dim str2(1) As String Dim myFile As String = "C:\TextFile1.txt" Try FileOpen(1, myFile, OpenMode.Input) Do Until EOF(1) str1 = LineInput(1) str2 = Split(str1, ",") hogen(str2(0)) = str2(1) 'hogen.Add(str2(0), str2(1)) 'hogen.Item(str2(0), str2(1)) Loop Catch ex As Exception MsgBox("読み込みエラー") Finally FileClose(1) End Try End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim str = TextBox1.Text Label1.Text = str If hogen(str) <> "" Then Label2.Text = hogen(str) Else Label2.Text = "は見つかりませんでした" End If End Sub
Link: Programming(5316d)
日録2008年_2月(5871d)
Last-modified: 2008-02-01 (金) 10:09:58 (6260d)