x09818
|
分享:
▲
依據您給我的訊息與說明 將其簡化請參考看看~ 複製程式
Public Class Form1
Dim writer As System.IO.StreamWriter
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.OpenFileDialog1.Filter = "文字檔案(*.txt)|*.txt"
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim line_array() As Object = Split(My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName), vbNewLine)
Dim data_temp As String = ""
Dim k As Integer = 0
data_temp = Join(line_array, ",")
Dim data_array() As Object = Split(data_temp, ",")
Dim temp_array(49) As Integer
For i = 0 To 49 : temp_array(i) = 0 : Next
For i = 0 To UBound(data_array)
If (IsNumeric(data_array(i))) Then
If (data_array(i) >= 1 And data_array(i) <= 49) Then
temp_array(Int(data_array(i))) += 1
k += 1
Else
temp_array(0) += 1
End If
Else
temp_array(0) += 1
End If
Next
TextBox1.Text = "統計結果:" & vbCrLf
For i = 1 To 49
TextBox1.Text &= "開出號碼為" & i & "的數量是" & temp_array(i) & vbCrLf
Next
TextBox1.Text &= "總計筆數:" & k & "筆"
End If
End Sub
End Class 資料檔 複製程式
期別,開獎日期,號碼1,號碼2,號碼3,號碼4,號碼5,號碼6,特別號碼 請依照本格式填入(只有01~49的數字會統計)
990001,99/01/01,01,02,03,04,05,06,07
990002,99/01/03,11,12,13,14,15,16,17
990003,99/01/05,01,02,03,04,05,06,07
990004,99/01/07,01,02,03,04,05,06,07
990005,99/01/10,01,02,03,04,05,06,07
990006,99/01/11,01,02,03,04,05,06,07
990007,99/01/13,01,02,03,04,05,06,07
990008,99/01/22,01,02,03,04,05,06,07 執行檔與資料檔於附件中~
此文章被評分,最近評分記錄財富:50 (by 三仙) | 理由: ^^ 因為您的參與,讓程式設計更容易!! | |
|
|
|