#2
qinyi922019-10-12 16:19
|
刚开始学习,请教各位大佬怎么循环数组
A1*1后面怎么多出个117,请教各位帮我看一下代码怎么修改
Public Class Form2
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim f As String
'设置打开的文本格式
OpenFileDialog1.Filter = "Text Files(*.TXT)|*.TXT"
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
f = (OpenFileDialog1.FileName)
'下面是把文本里的度分秒符号替换,这个是中海达格式
f = Replace(Trim(f), "°", ",")
f = Replace(Trim(f), "′", ",")
f = Replace(Trim(f), "″,", ",")
Dim f1 As String()
Dim f2 As Double, f3 As Double, f4 As Double
Dim f5 As String
Dim i As Integer, i1 As Integer
For i = 0 To f.Length
f1 = f.Split(",")
f2 = Val(f1(0) + f1(1) / 60 + f1(2) / 3600)
f3 = Val(f1(3) + f1(4) / 60 + f1(5) / 3600)
f4 = Val(f1(6))
f5 = f1(7)
TextBox1.Text = f2
'TextBox2.Text = f3
DataGridView1.Rows.Add(f2, f3, f4, f5)
Next
End If