C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » .NET Framework »

Tips in VB.NET - Tip #4


Posted Date: 21 Mar 2004    Resource Type: Articles    Category: .NET Framework
Author: Sadha SivamMember Level: Gold    
Rating: 1 out of 5Points: 10



Tips in VB.NET - Tip #4

How to get more than one value from a function or sub routine - Part III

In my previous article we have seen using the array and collection object to get more than one processed value from a function.

In this section, we will see one more method of getting the processed data from the function.

I believe most of you will be familer with structure. If not take a quick look at my previouse article Sturcture in VB.NET Part I, Part II, Part III, Part IV, Part V.

Now Let see how to implement the structure to get more than one processed data from the function.

As we all know structure is a collection of one or more variable, possibly of different data types, grouped together under a single name for convenient handling.

So, we can group all the data which needs to be returned by the function, into a Structure and then we can return the structure object.

So, using the structes we can indirectly get more than one processed data from the function.

Now, lets see how the function which we built in our previous article can be changed to use the structure.

I need a function which will return me the day of the week, month in words, Hour, minutes and seconds in Integer.


Structure DateData
Public strday As String
Public intmon As Integer
Public inthour As Integer
Public intmin As Integer
Public intsec As Integer
End Structure

Public Function ReturnDateInfo() As DateData
Dim dd As New DateData()
dd.strday = Format(DateTime.Today, "dddd")
dd.intmon = Month(DateTime.Today)
dd.inthour = Hour(DateTime.Now)
dd.intmin = Minute(DateTime.Now)
dd.intsec = Second(DateTime.Now)
Return dd
End Function


Is that not simple.



Note
This hold good for both C#, VB.Net


Please send me your suggestion and feedback to sadhasivam1981@yahoo.com.

Please vist http://sadhasivam.t35.com



Every Features has a purpose

Finding it leads to great benefits







Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Tips in VB.NET - Tip #3
Previous Resource: Tips in VB.NET - Tip #5
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use