Home > Software engineering >  Vb use MatrixVB plug-in drawing problems???
Vb use MatrixVB plug-in drawing problems???

Time:10-29

Tracing point data through a listview control input, the code is as follows:
 
The Function simulation ()
Dim h As the Variant
Dim I, j As Integer
Dim (x), y () As a Double
Dim a, b
Const value=3.1415926 'definition of PI PI
ReDim x (1, 1 To ListView1. ListItems. Count), y (1, 1 To ListView1. ListItems. Count) As a Double

For I=1 To ListView1. ListItems. Count
X (1, I)=ListView1. ListItems (I). SubItems (1) stored in the first column value
'Y (1, I)=ListView1. ListItems (I). SubItems (1) * Cos (PI/180 * ListView1 ListItems (I). SubItems (2))
'store the second column valueXlabel (" short ")
Ylabel (" height ")
Next I
A=mabs (x)
B=mabs (y)
H=the plot (a, b)
End the Function

Problem description: is originally want to pass the listview input data, a total of two columns of data, respectively, existing in the array, using the MatrixVB mabs () function matrix, the array can be converted to invoke the plot () function drawing, now, is always an error bounds, debugging saw, after the for loop, I=ListView1. ListItems. Count, is amended as:
 
The Function simulation ()
Dim h As the Variant
Dim I, j As Integer
Dim (x), y ()
Dim a, b
Const value=3.1415926 'definition of PI PI
ReDim x (1, 1 To ListView1. ListItems. Count), y (1, 1 To ListView1. ListItems. Count) As a Double

For I=1 To ListView1. ListItems. Count
X (1, I)=ListView1. ListItems (I). SubItems (1)
Y (1, I)=ListView1. ListItems (I). SubItems (1) * Cos (PI/180 * ListView1 ListItems (I). SubItems (2))

If j=ListView1 ListItems. Count Then
The Exit Function
End the If

Xlabel (" short ")
Ylabel (" height ")
Next I
A=mabs (x)
B=mabs (y)
H=the plot (a, b)
End the Function
, not crossing the line, graphics or not, to ask where is the problem?

  • Related