User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 391,609 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,625 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser:
Views: 339 | Replies: 1
Reply
Join Date: Sep 2007
Posts: 59
Reputation: evios is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

Select Case problem

  #1  
Jun 3rd, 2008
Lets say now i want to use Select Case For some purposes as shown below:

Here, i have two arrays, One is called strmac() and another one is mac().

strmac() is used to store the variable read from the database, it is used to read the Machine ID for example.

mac() is an array used to read the machine ID as well from the INI file.

For example, if lets say i want to loop through the database, first of all i need to go through the INI file first. If mac() has 3 elements of 123,134,144, then only these 3 machine ID will be selected when it read through the database.

Now;
Do While Not rs.EOF()
Select Case (strmac)
Case " mac(0) "
'Split it to 24 hours so that i can get the quantity for each hour
Case " mac(1) "
'Do whatever code here
......

The problem is, the code is very long because within each case, i still have many calculations and array which is used to store the count for each hour and it just follow some kind of format. And the size of mac() may changes time to time? Any concern to get it simpler? Thanks.....
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Posts: 287
Reputation: ericstenson is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 28
Colleague
ericstenson's Avatar
ericstenson ericstenson is offline Offline
Posting Whiz in Training

Re: Select Case problem

  #2  
Jun 4th, 2008
You could make each case it's own function

 
Case mac(0)

    RT_Mac_0

Case mac(1)

    RT_Mac_1

End Sub..


Public Sub RT_Mac_0

   Do whatever you want

End Sub

Public Sub RT_Mac_1

   Do whatever you want

End Sub
Make sense?
--
"Dummy."
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb VB.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 12:07 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC