Private Sub MenuItem2_Click(....
Dim FileName As String
Dim FileNum As Integer
Dim First As String
Dim hairetsu(999) AsString
Dim total As String
Dim ans, ans2, i, j, k As Integer
Dim openFile1 As New OpenFileDialog()
StatusBar1.Panels(2).Alignment = HorizontalAlignment.Center
StatusBar1.Panels(2).text = Now.Today
ListBox1.Refresh()
ListBox1.BeginUpdate()
ans = 0
ans2 = 0
j = 0
k = 0
ListBox1.Items.Clear()
ListBox2.Items.Clear()
StatusBar1.Panels(0).Text = ""
StatusBar1.Panels(1).Text = ""
Label1.Text = ""
Label3.Text = ""
openFile1.DefaultExt = "*.txt"
openFile1.Filter = "テキストファイル|*.txt"
If openFile1.ShowDialog() = DialogResult.OK Then
FileName = openFile1.FileName
Else
Exit Sub
End If
ListBox1.Refresh()
FileNum = FreeFile()
FileOpen( FileNum, FileName, OpenMode.Input )
Do Untill EOF(FileNum)
Input( FileNum, First )
ListBox2.Items.Add( First )
hairetsu(j) = First
j += 1
Input( FileNum, total )
ans = Val( yotal )
ans2 = ans2 + ans
ListBox1.Items.Add( First & "-" & total )
ListBox1.Refresh()
Loop
For i = 0 To ListBox2.Items.Count - 1
If i = 0 Then
Else
k = StrComp( hairetsu( i - 1 ), hairetsu(i), CompareMethod.Text )
If k = 1 Then
StatusBar1.Panels(1).Text = i + 1
Label3.ForeColor = ForeColor.Red
Label1.ForeColor = ForeColor.Red
ListBox1.ForeColor = ForeColor.Red
Label3.Text = "ERR"
Exit For
ElseIf k = 0 Then
StatusBar1.Panels(1).Text = i + 1
Label3.ForeColor = ForeColor.Red
Label1.ForeColor = ForeColor.Red
ListBox1.ForeColor = ForeColor.Red
Label3.Text = "ERR"
Exit For
ElseIf k = -1 Then
StatusBar1.Panel(1).Text = i + 1
Label3.ForeColor = ForeColor.White
Label3.Text = " O K "
End If
End If
Next
StatusBar1.Panels(0).Alignment = HorizontalAlignment.Center
StatusBar1.Panels(0).Text = ListBox1.Item.Count
Label1.Text = Format( ans2 , "#,###,###,###")
ListBox1.EndUpdate()
Erase hairetsu
FileClose( FileNum )
End Sub
0 件のコメント:
コメントを投稿