Two Question

  • Thread starter Thread starter WStoreyII
  • Start date Start date
W

WStoreyII

1) I have a structure named item which contains the following member
variables
1) Id
2) Category
3) Major
4) Minor
5) Memo
6) Amount
here is my problem in the sub new i can not initialize the propertys

for example

public sub new (id as integer)
me.id = id '' this will nto work i get the fuzzy line and it says taht
it produces a value so can not be the object of an assignment
end sub
the property is not readonly so i dont get it

2) I now how to create an xml element using the xmldocument,

dim e as xmlelement = dom.createelement ,

My question is how can i do this with out the document?

Thanks again

WStorey II
 
Structure Item
Public Id As Integer
Public Category As String
'etc

Public Sub New(ByVal id As Integer)
Me.Id = id
End Sub

End Structure

Public Class Class1
Public Sub New()
Dim myItem As New Item(99)
myItem.Category = "some category"
End Sub
End Class
 
Greg Burns said:
Structure Item
Public Id As Integer
Public Category As String
'etc
so what you are saying is that the variable has to be by value for a
structure is that why it would not work?
 
ByValue is just the default. ByRef compiles also. I don't think that is
relevant. I was just trying to demonstrate some syntax that works. Post
your code.
 
Back
Top