B
Brian Henry
I have code like the following set of code...
Public Structure ParamaterInformation
Public ParameterName As String
Public PromptText As String
Public DataType As String
Public DefaultValue As String
End Structure
Dim ht As New Hashtable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
For n As Integer = 1 To 100
Dim p As ParamaterInformation
p.DefaultValue = n.ToString
ht.Add(n, p)
Next
DirectCast(ht(4), ParamaterInformation).DefaultValue = "eregergv"
End Sub
I want to go into my hash table and alter the data in the stucture at
position for and change the defaultValue to another value... but when you do
DirectCast(ht(4), ParamaterInformation).DefaultValue = "eregergv"
it gives the error expression is a value and therefore can not be the target
of an assignment... but if i assign an object to the structure from the hash
table key 4 and then assign the value to the strcture it does not keep the
changes (im assumeing its not a reference pointer like i thought it probably
was?) how would i change the value of a structure like this in a hash table?
thanks
Public Structure ParamaterInformation
Public ParameterName As String
Public PromptText As String
Public DataType As String
Public DefaultValue As String
End Structure
Dim ht As New Hashtable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
For n As Integer = 1 To 100
Dim p As ParamaterInformation
p.DefaultValue = n.ToString
ht.Add(n, p)
Next
DirectCast(ht(4), ParamaterInformation).DefaultValue = "eregergv"
End Sub
I want to go into my hash table and alter the data in the stucture at
position for and change the defaultValue to another value... but when you do
DirectCast(ht(4), ParamaterInformation).DefaultValue = "eregergv"
it gives the error expression is a value and therefore can not be the target
of an assignment... but if i assign an object to the structure from the hash
table key 4 and then assign the value to the strcture it does not keep the
changes (im assumeing its not a reference pointer like i thought it probably
was?) how would i change the value of a structure like this in a hash table?
thanks