'file into the
'Private Sub Command5_Click ()
Dim x1 () As String, y1 () As String, z1 () As StringDim a1 As Double, b1 As Double, I As an Integer, r As an Integer, length As an Integer, STR As String
A1=Val (Text4. Text)
B1=Val (Text5. Text)
Open "C: \ Users \ \ Administrator \ Desktop \ coordinate data. TXT" For Input As # 1 I=1
The Do While Not EOF (1) the Line Input # 1, STR
The x1 (1)=Split (STR, ", ")
Y1 (1)=Split (STR, ", ")
Z1 (1)=Split (STR, ", ") & amp; VbCrLf
I=I + 1 loopclose # 1
Length=UBound (x1) - LBound (x1) + 1 r=0
While (I & lt; Length)
Call pl_DDZB_TO_KJZB (Val (x1 (r)), Val (y1 (r)), Val (z1 (r)), a1, b1)
Wend
End Sub
CodePudding user response:
The text file type
X, y, z
X, y, z
.
CodePudding user response:
1/f ,
引用 卡布奇诺的回复: text文件类型 X, y, z X, y, z ,,, TXT please! River's lake emergency! CodePudding user response:
Your x1, y1 z1 is defined as a variable array, and then is not defined in the number of array elements when using the x1 (1) assignment, didn't initialize array, And what are your cycle length continuous assignment? And r this variable did not see changes, but you end up with the x1 (r) While (i Fortunately had happened in front of the array subscript crossing the line, otherwise your application will enter the back of the infinite loop, So, suggest you to stroke your code single-step tracking again, and see if it is within your expectations CodePudding user response:
No continuous assignment!!!! That is not in the loop of the vb dynamic array initial words bosses how to help the first time I use vb CodePudding user response:
reference 3 floor crispy large ice cream response: your x1, y1 z1 is defined as a variable array, and then is not defined in the number of array elements when using the x1 (1) assignment, didn't initialize array, And what are your cycle length continuous assignment? And r this variable did not see changes, but you end up with the x1 (r) While (i Fortunately had happened in front of the array subscript crossing the line, otherwise your application will enter the back of the infinite loop, So, suggest you to stroke your code single-step tracking again, and see if it is within your expectations No continuous assignment!!!! That is not in the loop of the vb dynamic array initial words bosses how to help the first time I use vb CodePudding user response:
Or you Dim x1 (n) as string Or we'll Dim x1 () as string Redim x1 (n) While (I & lt; Length) Call pl_DDZB_TO_KJZB (Val (x1 (r)), Val (y1 (r)), Val (z1 (r)), a1, b1) Wend Consider these three lines well, unless you I can be in pl_DDZB_TO_KJZB is modified, CodePudding user response:
refer to 6th floor crispy big ice cream reply: or you Dim x1 (n) as string Or we'll Dim x1 () as string Redim x1 (n) While (I & lt; Length) Call pl_DDZB_TO_KJZB (Val (x1 (r)), Val (y1 (r)), Val (z1 (r)), a1, b1) Wend Consider these three lines well, unless you I can be in pl_DDZB_TO_KJZB is modified, Here is not the I r is I open this file and then assigned to count in the function of the three arrays and then extract the running in the now is the time to extract has a problem?? Who can give me a contact can send you the trouble to help me see CodePudding user response:
Changed, you see line not line like this: Private Sub Command5_Click () Dim a1 As Double A1=Val (text4. Text) Dim b1 As Double B1=Val (text5. Text) Open "C: \ Users \ \ Administrator \ Desktop \ coordinate data. TXT" For Input As # 1 Dim As Integer I The Do While Not EOF (1) Dim strLine As String The Line Input # 1, strLine Dim arrLine () As String ArrLine=Split (strLine, ", ") Call pl_DDZB_TO_KJZB (Val (arrLine (0)), Val (arrLine (1)), Val (arrLine (2)), a1, b1) Loop Close # 1 End Sub CodePudding user response:
refer to the eighth floor milaoshu1020 response: changed, you see line not line like this: Private Sub Command5_Click () Dim a1 As Double A1=Val (text4. Text) Dim b1 As Double B1=Val (text5. Text) Open "C: \ Users \ \ Administrator \ Desktop \ coordinate data. TXT" For Input As # 1 Dim As Integer I The Do While Not EOF (1) Dim strLine As String The Line Input # 1, strLine Dim arrLine () As String ArrLine=Split (strLine, ", ") Call pl_DDZB_TO_KJZB (Val (arrLine (0)), Val (arrLine (1)), Val (arrLine (2)), a1, b1) Loop Close # 1 End Sub Thank god I have done