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 #5


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 #5

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

In this section, we will use the other way of getting more than one processed data from a function and a sub routine.

As you all know a sub routine can never return a value. But I can get some useful data from the sub routine also. I am, not kidding, you can get the data from a sub routine also.

Do you know anything about Call by Value and Call by Reference. If not read the article, click here to read the article.

In .Net it is done by ByVal and ByRef keyword. where if the parameter as passed using ByVal actually a copy of that is passed so any changes to the object will not affect the original. In the case of using ByRef the refernce of the object is sent to the function. so any changes to the parameter inside the function, will affect the original object also.

So, I can pass the objects using ByRef keyword to get the processed data from the function.

Now, lets modify the function we defined in the last article.



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




Public Sub GetDateInfo(ByRef strday As String, _
ByRef intmon As Integer, _
ByRef inthour As Integer, _
ByRef intmin As Integer, _
ByRef intsec As Integer)

strday = Format(DateTime.Today, "dddd")
intmon = Month(DateTime.Today)
inthour = Hour(DateTime.Now)
intmin = Minute(DateTime.Now)
intsec = Second(DateTime.Now)

End Sub


Try using the above function.



If any one of you know any way other than this ways. Please Mail me.
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 #4
Previous Resource: Tips in VB.NET - Tip #6
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