Hello!!! I want to create a function with 3 arguments of integers but it's necessary to return 3 values too... So, I created a structure FreePlayings that holds an integer for each field variable.
Public Structure FreePlayings
Dim frees1 As Integer
Dim frees2 As Integer
Dim frees3 As Integer
End Structure
Public Function CheckPcPossiblePlayings(ByVal RvrseRd1 As Integer, ByVal RvrseRd2 As Integer, ByVal RvrseSumRd As Integer) As FreePlayings
Dim frees1, frees2, frees3 As Integer
Dim free1, free2, free3 As Boolean
Dim x As New FreePlayings
For j As Byte = 0 To UsrCheckerGates.Length - 1
If UsrCheckerGates(j).pos <> RvrseRd1 And RvrseRd1 <> 0 Then
free1 = True
frees1 += 1
End If
If UsrCheckerGates(j).pos <> RvrseRd2 And RvrseRd2 <> 0 Then
free2 = True
frees2 += 1
End If
If UsrCheckerGates(j).pos <> RvrseSumRd And RvrseSumRd <> 0 Then
free3 = True
frees3 += 1
End If
Next
x.frees1 = frees1
x.frees2 = frees2
x.frees3 = frees3
Return x
End Function
Unfortunately I'm getting error Error 2 'CheckPcPossiblePlayings' cannot expose type 'Module1.FreePlayings' outside the project through class 'Form1'.
It seems like problem with the returning type of the function.
I' m calling the function in that way in my main program
Dim FreePlngs As New FreePlayings
FreePlngs.frees1 = CheckPcPossiblePlayings(RvrseRd1, RvrseRd2, RvrseSumRd).frees1
FreePlngs.frees2 = CheckPcPossiblePlayings(RvrseRd1, RvrseRd2, RvrseSumRd).frees2
FreePlngs.frees3 = CheckPcPossiblePlayings(RvrseRd1, RvrseRd2, RvrseSumRd).frees3
The problem is not with the way I' m calling the function, because I put it inside comments. Any help please??? What can I do??? Any help will be much appreciated. Thank you so much in advanced.
Public Structure FreePlayings
Dim frees1 As Integer
Dim frees2 As Integer
Dim frees3 As Integer
End Structure
Public Function CheckPcPossiblePlayings(ByVal RvrseRd1 As Integer, ByVal RvrseRd2 As Integer, ByVal RvrseSumRd As Integer) As FreePlayings
Dim frees1, frees2, frees3 As Integer
Dim free1, free2, free3 As Boolean
Dim x As New FreePlayings
For j As Byte = 0 To UsrCheckerGates.Length - 1
If UsrCheckerGates(j).pos <> RvrseRd1 And RvrseRd1 <> 0 Then
free1 = True
frees1 += 1
End If
If UsrCheckerGates(j).pos <> RvrseRd2 And RvrseRd2 <> 0 Then
free2 = True
frees2 += 1
End If
If UsrCheckerGates(j).pos <> RvrseSumRd And RvrseSumRd <> 0 Then
free3 = True
frees3 += 1
End If
Next
x.frees1 = frees1
x.frees2 = frees2
x.frees3 = frees3
Return x
End Function
Unfortunately I'm getting error Error 2 'CheckPcPossiblePlayings' cannot expose type 'Module1.FreePlayings' outside the project through class 'Form1'.
It seems like problem with the returning type of the function.
I' m calling the function in that way in my main program
Dim FreePlngs As New FreePlayings
FreePlngs.frees1 = CheckPcPossiblePlayings(RvrseRd1, RvrseRd2, RvrseSumRd).frees1
FreePlngs.frees2 = CheckPcPossiblePlayings(RvrseRd1, RvrseRd2, RvrseSumRd).frees2
FreePlngs.frees3 = CheckPcPossiblePlayings(RvrseRd1, RvrseRd2, RvrseSumRd).frees3
The problem is not with the way I' m calling the function, because I put it inside comments. Any help please??? What can I do??? Any help will be much appreciated. Thank you so much in advanced.