2013年4月23日火曜日

比較


VB.NET


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim array As ArrayList = New ArrayList
        array.Clear()
        array.Add(TextBox1.Text)
        array.Add(TextBox2.Text)
        array.Add(TextBox3.Text)
        array.Add(TextBox4.Text)

        Dim str1 As String = String.Empty
        Dim str2 As String = String.Empty

        For i As Integer = 0 To array.Count - 1
            'i
            str1 = array.Item(i)

            'i=i-1
            If str1 = str2 Then
                MessageBox.Show("同じです")
            Else
                MessageBox.Show("違います")
            End If

            'i-1
            str2 = array.Item(i)
        Next

    End Sub
End Class