Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I access the fields of a structure that included in a class through class and form code?

Status
Not open for further replies.

WomanPro

Programmer
Nov 1, 2012
180
GR
Hello everybody!!! Well I have a class created by myself named MyClass and inside the class I have created the following structure. The what I would like to do, is to access the properties of m_NumDice through the entire class and through the form source code. How can I achieve that? Is there a way or should I have to make it via creating simple properties into the external class and forgetting absolutely the structure m_NumDice???
I tried onto the form load event to access it as MyClass.m_NumDice. what??? no fields appearing...
Any suggestions please??? Any help will be much appreciated. Thank you very much in advanced.

Public Class MyClass
Public Structure m_NumDice
Public NumRd1 As Integer
Public NumRd2 As Integer
Public NumSumRd As Integer

Public Sub New(ByVal val1 As Integer, ByVal val2 As Integer, ByVal sumval As Integer)
NumRd1 = val1
NumRd2 = val2
NumSumRd = sumval
End Sub

Public Property NumDice() As m_NumDice
Get
Return New m_NumDice(NumRd1, NumRd2, NumSumRd)
End Get
Set(ByVal value As m_NumDice)
NumRd1 = value.NumRd1
NumRd2 = value.NumRd2
NumSumRd = value.NumSumRd
End Set
End Property
End Structure
End Class
 
Finally solved
Dim x As New MyClass.m_NumDice
x.NumRd1 = UsrDice1Tmp
x.NumRd2 = UsrDice2Tmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top