请帮助看看自定义组件里的数组为何出错,谢谢!!!
Public Class Form5
Private Sub Form5_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Table1.Col = 7
Table1.Row = 7
For i As Short = 0 To Table1.Col - 1
Table1.newlist1(i).Name = "GHH" & i
For ii As Short = 0 To Table1.Row - 1
Table1.newlist1(i).Name1(ii) = "GHgH" & ii
Next
Next
End Sub
End Class
‘’‘’‘’‘’‘’‘’‘’‘’‘’
Public Class Table
Inherits Control
Structure NEWtableCell
Dim x1 As Single
Dim x2 As Single
Dim Name As String
Dim Name1() As String
End Structure
Private _Col As Short = 0
Public newlist1() As NEWtableCell
Public Property Col() As Short
Get
Return _Col
End Get
Set(ByVal Value As Short)
_Col = Value
'>>此处加上这些代码
' If (_Col > 0) Then
' newlist1 = New NEWtableCell(_Col)
ReDim newlist1(Col - 1)
ReDim newlist1(Col - 1).Name1(Row - 1)
' For i As Short = 0 To _Col - 1
' newlist1(i) = New NEWtableCell()
' Next
' End If
'<<此处加上这些代码
'Refresh()
Invalidate()
End Set
End Property
Private _Row As Integer = 0 'newnlabel.MODE