How do you return multiple values in a function?
yorro
-6
Junior Poster
Recommended Answers
Jump to PostThat depends. Are the values all of the same type? If so you can have the function return a typed list:
Public Function MultipleReturn() As List(Of String) Dim places As New List(Of String) places.Add("A") places.Add("B") places.Add("C") places.Add("D") return places
Jump to PostA list or ListArray can be returned from a function as Ryshad suggests above. Another option is you can create a user defined structure and pass that back from your function.
Public Structure Student Public Name As String Public Age As Integer Public GradePointAverage As Decimal End …
Jump to PostIt depends on the data that your sending back but I was thinking you might also be able to return the info in a dataset or datarow.
All 12 Replies
Geekitygeek
480
Nearly a Posting Virtuoso
TomW
73
Posting Whiz
yorro
-6
Junior Poster
TomW
73
Posting Whiz
yorro
-6
Junior Poster
TomW
73
Posting Whiz
yorro
-6
Junior Poster
TomW
73
Posting Whiz
yorro
-6
Junior Poster
TomW
73
Posting Whiz
yorro
-6
Junior Poster
TomW
73
Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.