Hello, all, wondering if someone can tell me what I'm doing wrong here. I'm simply trying to pass a structure array to another function for some evaluation. The problem is, it hits an error when I try to pass it. I'm using VB.NET 2003. Here is my code below.
VB Code:
Private Structure Fields Dim FieldName As String Dim FieldValue As String End Structure 'In declarations section Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click Dim ArrValidate() As Fields Dim cntrl As Control Dim X As Long 'Fill my array For Each cntrl In Me.Controls X = X + 1 ReDim Preserve ArrValidate(X) ArrValidate(X).FieldName = cntrl.Name ArrValidate(X).FieldValue = cntrl.Text Next cntrl 'Pass the array to my function located in another class Validation.Validate_frmProducts(ArrValidate) 'Dies here end sub
Error I get is:
Z:\HTTP\ProductMgmtApp\frmProducts.vb(576): Value of type 1-dimensional 'array of ManagementApp.frmProducts.Fields' cannot be converted to '1-dimensional array of System.Object' because 'ManagementApp.frmProducts.Fields' is not a reference type.
Anyone know what I'm doing wrong? Thanks in advance
Strick




Reply With Quote