CodeWidgets.com Online Source Code Library -ASP, ASP.NET, VB, VB.Net, Microsoft® Access, Javascript, VBScript, Website Design, Web Applications, Custom Programming Services Available.

 CodeWidgets.com ASP, ASP.NET, VB, VB.Net,
Microsoft® Access, Javascript, VBScript,
Website Design, Web Applications
Shopping Cart (0) Items $0.00      
 CodeWidgets.com
CodeWidgets.com

 

Website Stats to Date

Pages Viewed 6,975,154
Visitors 1,668,084
Widgets Viewed 4,500,691
Since January 1/2003
 
 
Active Users: 15
 

 
PayPal: Secure online payments!
 
Widget #CS0055

Create a function that returns multiple values.

Create a function that returns multiple values.

Send Link

Questions

Currency Conv.
  Widget Info  
VB 6.0, VB.NET
Using Structures or Types

'VB 6.0 Create a Type to store your values in
Public Type vbTwoDates
m_StartDate As Date
m_EndDate As Date
End Type

'Function to return the multiple values
Function GetDates(ByVal dtValue As Date) As vbTwoDates
'Pass values to the Members of the GetDates function declared as Type vbTwoDates
GetDates.m_StartDate = dtValue - 3
GetDates.m_EndDate = dtValue + 3
End Function

Public Sub ShowDates()
'declare a variable of the Type vbTwoDates
Dim dtTwoDays As vbTwoDates
'Fill the variable declared as vbTwoDates using the function
dtTwoDays = GetDates(Date())
'display the values
MsgBox dtTwoDays.m_StartDate & " to " & dtTwoDays.m_EndDate
End Sub

'VB.NET Create a Structure to store your values in

Public Structure vbTwoDates

Public m_StartDate As System.DateTime

Public m_EndDate As System.DateTime

End Structure

'Function to return the multiple values

Function GetDates(ByVal dtValue As System.DateTime) As vbTwoDates

'Pass values to the Members of the GetDates function declared as Type vbTwoDates

Dim Duration As System.TimeSpan

Duration = New System.TimeSpan(3, 0, 0, 0, 0)

GetDates.m_StartDate = dtValue.Subtract(Duration)

GetDates.m_EndDate = dtValue.Add(Duration)

End Function

Public Sub ShowDates()

'declare a variable of the Type vbTwoDates

Dim dtTwoDays As vbTwoDates

'Fill the variable declared as vbTwoDates using the function

dtTwoDays = GetDates(System.DateTime.Today)

'display the values

MsgBox(dtTwoDays.m_StartDate.ToString & " to " & dtTwoDays.m_EndDate.ToString)

End Sub

 Licensing
Format: Plug & Play Code
Copy the Source Code Above..
Licencing Terms: No Restrictions
Re-Distribution Permitted
This source code is provided to you "as is" without warranty
CLICK HERE FOR TERMS OF USE
Copyright 2002-2006 Comrie Software Solutions
 Related Widgets

Add Sounds to button events. ASP.NET
Age Function VB 6.0 Using DateDiff()
Alpha-Tabbed Address Book for Microsoft® Access
Auto highlight the active Control on a Webform (ASP.NET)
Corrupted Access Database Repair
Create a Session Database Connection through code (ASP.NET)
Enable/Disable Form Controls with Loop Code
HTML EMail Merge using Microsoft® Access
Storing a DataSet in a Session Variable (ASP.NET)
Synchronize Remote .mdb Front-Ends Automatically

ShoppingCart Empty
Services Contact Info Legal Info
Designated trademarks and brand names are the property of their respective owners.

By accessing this website it is assumed that you agree to the TERMS OF USE.

Send questions or comments regarding this website to  Comrie Software Solutions.

Click here for a complete list of available Widgets.