|
-
Feb 1st, 2005, 07:40 PM
#1
Thread Starter
Junior Member
Select Case Statement
Using a Select Case Statement to determine customer's Status. Either Retail or wholeSale. is the correct code
VB Code
----------------
Private Sub ProcessOperationRadioButtons(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles WholeRadioButton.Click
Dim intRetail, intWholesaler As Integer
'display appropriate operator
Select Case True
Case 1
Me.WholeRadioButton.Checked = intWholesaler
Case Else
Me.RetailRadioButton.Checked = intRetail
End Select
End Sub
---------------
end code
Last edited by terrytemes; Feb 2nd, 2005 at 05:25 AM.
Reason: resolved
-
Feb 1st, 2005, 07:53 PM
#2
PowerPoster
Re: Select Case Statement
Hi,
No. But the correct method is not clear from your posting. I think you want
VB Code:
Select Case True
Case Me.WholeRadioButton.Checked
MessageBox.Show("Wholesaler")
Case Else
MessageBox.Show("Retailer")
End Select
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Feb 1st, 2005, 08:32 PM
#3
Thread Starter
Junior Member
Re: Select Case Statement
Thanks that is what I orginally thought. By selecting either wholesale or Retail the price changes. So I was try to figure out how to then calculate different prices charged in an If then statement.
-
Feb 1st, 2005, 09:00 PM
#4
PowerPoster
Re: Select Case Statement
Hi,
OK, so:
VB Code:
Select Case True
Case Me.WholeRadioButton.Checked
ChargePrice=WholesalePrice
Case Else
ChargePrice = RetailPrice
End Select
Return ChargePrice
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Feb 1st, 2005, 09:25 PM
#5
PowerPoster
Re: Select Case Statement
But you wouldn't normally use Select Case where there are only two possibilities, If...Then...Else would be more usual. Select Case is really meant for situations where there are many choices. Though it will work perfectly well.
-
Feb 2nd, 2005, 01:28 AM
#6
Thread Starter
Junior Member
Re: Select Case Statement
Thanks Taxes, you really helped. It took me awhile studying your code to understand it. It was a big help for this newbie. I agree with you Super Sparks, this bit of code was only meant to help me learn how to combine the select case with an IF Else statement using radio buttons.
Last edited by terrytemes; Feb 2nd, 2005 at 05:24 AM.
Reason: Resloved
-
Feb 2nd, 2005, 05:26 AM
#7
PowerPoster
Re: Select Case Statement
Hi,
The excerpt of code you previously posted is not the same as you actually used.
You cannot check for numerical entry in the way you are trying. Look in the code bank at
http://www.vbforums.com/showthread.php?t=314936
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Feb 2nd, 2005, 05:27 AM
#8
PowerPoster
Re: Select Case Statement
 Originally Posted by SuperSparks
But you wouldn't normally use Select Case where there are only two possibilities, If...Then...Else would be more usual. Select Case is really meant for situations where there are many choices. Though it will work perfectly well.
Agreed, but I was just staying with what he produced.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|