Sunday, October 10, 2004

Tips in VB.NET - Tip #4

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.

Posted by Sadha at 16:56:58 | Permalink | Comments (3)

Monday, September 27, 2004

Tips in VB.NET - Tip #3

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

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

Before that lets see what is Collection and what can be done with a collection.

Collections
Collection represents a set of objects that can be access by stepping through each element in turn.
What is the big deal ?. Even an array can hold a set of objects.

True, but we have more flexibility when we use a collection object when compared to arrays.


http://www.dotnetspider.com/Technology/KB/ShowSample.aspx?SampleId=292


 

Posted by Sadha at 12:42:10 | Permalink | Comments (1) »

Friday, September 24, 2004

Tips in VB.NET - Tip #2

Tips in VB.NET - Tip #2

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

In this part of tip we will how we can get more than one processed data from a function or a sub routine.

First lets see how to get the multiple values from a Function.
As we all know that we can get only one value or an object from a function. What can we do, if we want to get more than one processed data. There is no possible way directly to get more than one value. But we can find more number of Indirect ways of getting processed data from the function.

Click here to view the comple article.....

Posted by Sadha at 04:48:44 | Permalink | Comments (1) »

Thursday, September 16, 2004

Tips in VB.NET - Tip #1


Tips in VB.NET - Tip #1

Introduction

Hai everybody, In this series of articles, I am going to give you some tips in .Net which may help you a lot.
I want you people to ask me a lot of questions, so that I can deliver more to you. Send me your doubts and questions to sadhasivam1981@yahoo.com.

Now, lets get into the Tip #1.

Tip #1 Generally to invoke a method or to get a value of a property we will be declaring an object and initialising it and then using that object we will be calling it. Lets have a look at the following code

Click here to view the tip from dotnetspider.com


Posted by Sadha at 12:13:45 | Permalink | No Comments »