Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return 2 values from a function
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01355203
Message ID:
01355208
Vues:
27
>Hi All,
>
>I need to return 2 values from a VB.NET function. One is data type integer and the other string.
>What is the best approach to acomplish that?
>
>Thanks,
>Daniel

Create a structure or a class, add these two types to it, then return that instead.
Public Structure MyStruct
   Private Dim m_MyNumber As Integer
   Private Dim m_MyString As String

   Public Property MyNumber As Integer
      Get
         Return Me.m_MyNumber
      End Get
      Set
         Me.m_MyNumber = value
   End Property

   Public Property MyString As String
      Get
         Return Me.m_MyString
      End Get
      Set
         Me.m_MyString = value
   End Property

   Public Sub New(ByVal num As Integer, ByVal str As String)
      Me.m_MyNumber = num
      Me.m_MyString = str
   End Sub

End Structure
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform