Select Case problem

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 60
Reputation: evios is an unknown quantity at this point 
Solved Threads: 0
evios evios is offline Offline
Junior Poster in Training

Select Case problem

 
0
  #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;
  1. Do While Not rs.EOF()
  2. Select Case (strmac)
  3. Case " mac(0) "
  4. 'Split it to 24 hours so that i can get the quantity for each hour
  5. Case " mac(1) "
  6. 'Do whatever code here
  7. ......

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.....
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 291
Reputation: ericstenson is an unknown quantity at this point 
Solved Threads: 29
Team Colleague
ericstenson's Avatar
ericstenson ericstenson is offline Offline
Posting Whiz in Training

Re: Select Case problem

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

  1.  
  2. Case mac(0)
  3.  
  4. RT_Mac_0
  5.  
  6. Case mac(1)
  7.  
  8. RT_Mac_1
  9.  
  10. End Sub..
  11.  
  12.  
  13. Public Sub RT_Mac_0
  14.  
  15. Do whatever you want
  16.  
  17. End Sub
  18.  
  19. Public Sub RT_Mac_1
  20.  
  21. Do whatever you want
  22.  
  23. End Sub
Make sense?
--
"Dummy."
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC