在线等待,帮帮忙
'定义
Public Class Map
Public item() As mapItem
End Class
Public Class mapItem
Public key As String
Public value As String
End Class
'读写数据
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ddmap As Map=new Map()
Dim ddmapItem As mapItem
ddmapItem = New mapItem()
ddmapItem.key = "PASSWORD"
ddmapItem.value = "pwd"
ddmap.item(0) = ddmapItem '这里报错,不知道怎么解决,也不知道怎么读写数据
End Sub
[解决办法]
你要根据需要先把ddmap.item Redim一下才行啊!
Dim ddmap As Map=new Map()
Dim ddmapItem As mapItem
ddmapItem = New mapItem()
ddmapItem.key = "PASSWORD"
ddmapItem.value = "pwd"
Redim ddmap.item(0)
ddmap.item(0) = ddmapItem '这里报错,不知道怎么解决,也不知道怎么读写数据