Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 19-02-2008, 12:21 PM   #1 (permalink)
Right Off the Assembly Line
 
puneet.darji's Avatar
 
Join Date: Jun 2007
Location: Mumbai
Posts: 7
Default Passing enum as parameter (vb.net)


E.g.

public Enum season
winter=0
summer=1
end enum
public Enum month
jan=0
feb=1
end enum

There are two different enums i want to pass in one common function like.


pubic function fillenum(i send above enum as parameter)

end function

At the time of calling function :-

button_click
fillenum(season)
fillenum(month)
end sub


is this posible.

Thnx in adavance


Last edited by puneet.darji; 19-02-2008 at 12:28 PM. Reason: a
puneet.darji is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 19-02-2008, 01:40 PM   #2 (permalink)
Rubik's Uncle!!
 
Charan's Avatar
 
Join Date: Sep 2004
Location: ಬೆಂಗಳೂರು (Bengaluru)
Posts: 3,783
Default Re: Passing enum as parameter (vb.net)

^^ you cannot directly pass the enum season or month cause its a type. you have to declare a variable and then passthat to the function

something like this, just a rough example.
Code:
Public Enum season
        winter = 0
        summer = 1
    End Enum
    Public Enum month
        jan = 0
        feb = 1
    End Enum

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim se As season
        Dim mon As month
        test(se)
        test(mon)
    End Sub

    Sub test(ByRef ses As season)
        MessageBox.Show(ses.summer.ToString & vbCrLf & ses.winter.ToString)
    End Sub

    Sub test(ByRef mo As month)
        MessageBox.Show(mo.feb.ToString & vbCrLf & mo.jan.ToString)
    End Sub
__________________
i5 2400 | DH67BL | G.Skill Ripjaw 4 GB | FSP SAGA II 500W | CM 430 Black Elite | MSI R6850 Cyclone PE/OC | XBox 360 Controller | 21.5" Samsung Sync Master 2233 | 4 Mbps @75GB FUP :)
Battlefield 3 Multiplayer Discussion | Battlefield 3 Low Latency Servers List
Charan is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:52 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2