Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old March 30th, 2004, 10:13 AM
lsrouse lsrouse is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 lsrouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Select Case confusion

Sorry I should have been more descriptive. The problem I am having is with the TotalValue variable, am I not assigning things right here or
is there something wrong with my Select Case decision making? I have the same problem using IF...Then statements.

Try this code and if you would and please help me understand why the TotalValue variable is not storing the string I assign to it please.

PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim FirstValue AsInteger
Dim SecondValue AsInteger
Dim TotalValue AsInteger
Dim ValueToDisplay AsString

FirstValue = txtFirstValue.Text
SecondValue = txtSecondValue.Text
ValueToDisplay = lblMessage.Text

TotalValue = FirstValue * SecondValue
lblTotalValue.Text = TotalValue

SelectCase TotalValue

Case TotalValue > 100

ValueToDisplay = "This is a Big Number"

Case TotalValue < 100

ValueToDisplay = "This is a Little Number"

EndSelect

MessageBox.Show("Reached the end of the program")

EndSub


Last edited by lsrouse : March 30th, 2004 at 11:42 AM. Reason: Code Looks Terrible

Reply With Quote
  #2  
Old April 9th, 2004, 08:51 AM
lsrouse lsrouse is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 2 lsrouse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes I'm just as confused!

Ok so was the question not clear enough?

Reply With Quote
  #3  
Old April 9th, 2004, 09:38 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,751 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 3 h 32 m 46 sec
Reputation Power: 443
try this (assuming it is VB.NET and not Visual Basic)
Code:
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

   Dim FirstValue As Integer
   Dim SecondValue As Integer
   Dim TotalValue As Integer
   Dim ValueToDisplay As String

   FirstValue = Integer.Parse(txtFirstValue.Text)
   SecondValue = Integer.Parse(txtSecondValue.Text)

   TotalValue = FirstValue * SecondValue
   lblTotalValue.Text = TotalValue

   Select Case TotalValue
      Case TotalValue > 100
         ValueToDisplay = "This is a Big Number"
      Case TotalValue < 100
         ValueToDisplay = "This is a Little Number"
   End Select

   lblMessage.Text = ValueToDisplay
   MessageBox.Show("Reached the end of the program")

End Sub

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Select Case confusion


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway