943,568 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1518
  • VB.NET RSS
Jun 3rd, 2008
0

Select Case problem

Expand Post »
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;
VB.NET Syntax (Toggle Plain Text)
  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.....
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
evios is offline Offline
60 posts
since Sep 2007
Jun 4th, 2008
0

Re: Select Case problem

You could make each case it's own function

VB.NET Syntax (Toggle Plain Text)
  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?
Team Colleague
Reputation Points: 14
Solved Threads: 29
Posting Whiz in Training
ericstenson is offline Offline
293 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: textbox validation
Next Thread in VB.NET Forum Timeline: Backup an access database





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC