Click here to Skip to main content
15,912,205 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Need system clock advice. Pin
Luc Pattyn19-Apr-11 14:32
sitebuilderLuc Pattyn19-Apr-11 14:32 
AnswerRe: Need system clock advice. Pin
Bernhard Hiller25-Apr-11 22:05
Bernhard Hiller25-Apr-11 22:05 
QuestionVisual Basic 2010 printing on a Zebra via serial port Pin
EdMee19-Apr-11 8:11
EdMee19-Apr-11 8:11 
AnswerRe: Visual Basic 2010 printing on a Zebra via serial port Pin
Dave Kreskowiak19-Apr-11 13:38
mveDave Kreskowiak19-Apr-11 13:38 
GeneralRe: Visual Basic 2010 printing on a Zebra via serial port Pin
EdMee21-Apr-11 11:40
EdMee21-Apr-11 11:40 
GeneralRe: Visual Basic 2010 printing on a Zebra via serial port Pin
Dave Kreskowiak21-Apr-11 12:05
mveDave Kreskowiak21-Apr-11 12:05 
QuestionConvert From Vb.Net 2008 To Vb.Net2010 [DMO Problem] Pin
Paramu197318-Apr-11 5:23
Paramu197318-Apr-11 5:23 
AnswerRe: Convert From Vb.Net 2008 To Vb.Net2010 [DMO Problem] Pin
Simon_Whale18-Apr-11 5:33
Simon_Whale18-Apr-11 5:33 
JokeRe: Convert From Vb.Net 2008 To Vb.Net2010 [DMO Problem] Pin
Andy_L_J24-Apr-11 1:52
Andy_L_J24-Apr-11 1:52 
QuestionLogin Project Help... Pin
dzhello18-Apr-11 4:01
dzhello18-Apr-11 4:01 
AnswerRe: Login Project Help... Pin
Dave Kreskowiak18-Apr-11 4:38
mveDave Kreskowiak18-Apr-11 4:38 
AnswerRe: Login Project Help... Pin
Simon_Whale18-Apr-11 5:31
Simon_Whale18-Apr-11 5:31 
QuestionProject Help! Pin
Member 784273314-Apr-11 16:15
Member 784273314-Apr-11 16:15 
AnswerRe: Project Help! Pin
Luc Pattyn15-Apr-11 0:17
sitebuilderLuc Pattyn15-Apr-11 0:17 
AnswerRe: Project Help! Pin
_Erik_18-Apr-11 3:19
_Erik_18-Apr-11 3:19 
Questionvisual basic data report Pin
sandeepkumardadwal11-Apr-11 19:30
sandeepkumardadwal11-Apr-11 19:30 
AnswerRe: visual basic data report Pin
Abhinav S11-Apr-11 21:00
Abhinav S11-Apr-11 21:00 
AnswerRe: visual basic data report Pin
thatraja12-Apr-11 18:36
professionalthatraja12-Apr-11 18:36 
QuestionBest way to return class at runtime - based on value Pin
DeepToot7-Apr-11 7:23
DeepToot7-Apr-11 7:23 
I have a task that is being repeated throughout the application many times. My goal is to take those methods and consolidate it into a Global method.

The problem I am running into is that each task uses a different class type.

My thoughts were to create a method, say IncrementLine(), passing in as a parameter an Enum that would tell it what class it is coming from (Rooms or Library for instance).

This is an example of the existing code from one of these methods: (Also this is the exact code I need to change to bring back different classes, instead of RoomData it could be LibraryData - instead of Room it could be Library)

Dim lstRooms As List(Of RoomData) = Room.LoadAllForLibrary(libraryID)


The code for each of my methods that call IncrementLine() have their own classes like RoomData and Room. With the exception of the code above the rest of the method codes are identical.

Without using a bunch of Selects to determine what Class I should use..how can I return the proper class based on the enum passed in?


I was thinking of maybe using a Generic Delegate Class..something like this:
Public Function ReturnClass(Of t)(ByVal _lType As ListType) As t

End Function


based on what enum value they place it would send back the correct class..however, once I created this class I realized I'd still have to do a Select to determine what ListType they provided.

So my question is, how can I change the code above to be dynamic in returning the proper class based on the enum?

Thanks
AnswerRe: Best way to return class at runtime - based on value Pin
Ali Al Omairi(Abu AlHassan)7-Apr-11 11:16
professionalAli Al Omairi(Abu AlHassan)7-Apr-11 11:16 
AnswerRe: Best way to return class at runtime - based on value Pin
Eddy Vluggen8-Apr-11 0:31
professionalEddy Vluggen8-Apr-11 0:31 
GeneralRe: Best way to return class at runtime - based on value Pin
Ali Al Omairi(Abu AlHassan)10-Apr-11 10:06
professionalAli Al Omairi(Abu AlHassan)10-Apr-11 10:06 
GeneralRe: Best way to return class at runtime - based on value Pin
DeepToot11-Apr-11 4:05
DeepToot11-Apr-11 4:05 
QuestionWrite special cahrs from database to text file using vb.net Pin
vijay24825-Apr-11 5:30
vijay24825-Apr-11 5:30 
AnswerRe: Write special cahrs from database to text file using vb.net Pin
Luc Pattyn5-Apr-11 5:53
sitebuilderLuc Pattyn5-Apr-11 5:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.