473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

case ist & else case is executing and not others.

The case ist & else case is executing but not others

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim marks As Integer 
  3.         marks = CInt(TextBox1.Text)
  4.         Select Case marks
  5.             Case Is > 35
  6.                 MsgBox("number is greater than 35")
  7.  
  8.             Case Is > 50
  9.                 MsgBox("number is greater than 50")
  10.             Case Is > 65
  11.                 MsgBox("number is greater than 65")
  12.             Case Is > 75
  13.                 MsgBox("number is greater than 75")
  14.             Case Else
  15.                 MsgBox("wrong entery")
  16.         End Select
  17.     End Sub
Nov 25 '13 #1
2 1240
Luuk
1,047 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Dim marks As Integer
  3. marks = CInt(TextBox1.Text)
  4. Select Case marks
  5. Case Is > 35
  6. MsgBox("number is greater than 35")
  7.  
hmm, above you tested if its >35, what will be the answer to the next question?
Expand|Select|Wrap|Line Numbers
  1. Case Is > 50
  2. MsgBox("number is greater than 50")
  3. Case Is > 65
  4. MsgBox("number is greater than 65")
  5. Case Is > 75
  6. MsgBox("number is greater than 75")
  7. Case Else
  8. MsgBox("wrong entery")
  9. End Select
  10. End Sub 

I sure love the possibility of these '[code]'-tags....
Nov 25 '13 #2
Frinavale
9,735 Expert Mod 8TB
Consider changing the order of your select cases so that the largest value is the first case and the smallest value is the last one.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim marks As Integer 
  3.         marks = CInt(TextBox1.Text)
  4.         Select Case marks
  5.             Case Is > 75
  6.                 MsgBox("number is greater than 75")               
  7.              Case Is > 65
  8.                 MsgBox("number is greater than 65")
  9.             Case Is > 50
  10.                 MsgBox("number is greater than 50")
  11.             Case Is > 35
  12.                 MsgBox("number is greater than 35")
  13.             Case Else
  14.                 MsgBox("wrong entery")
  15.         End Select
  16.     End Sub
Dec 2 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: DaaaDaaa | last post by:
Hi, Here's what I'd like to do: table (Orders) has fields of Processed, Paid (both of boolean yes|no) etc, I want to return a count of of Total number of Orders, Number of Processed vs. Number...
3
by: Tee | last post by:
Hi, How to case select with case-insensitive ? eg: Select Case Textbox1.Text Case "Hello" -- ( this will include "Hello", "HELLO", "hElLo" etc etc. ) Case "Bye"
2
by: A Bruce | last post by:
hello, I am attempting to convert a oracle database to postgresql and I am having some problems creating a constraint across multiple columns which are a mixture of case insensitive and case...
110
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst...
14
by: fniles | last post by:
In VB.NET 2005 can I check if a letter in a string is upper case or lower case ? For example: I have the following 2 lines: NQ,Z2003,11/11/2003,1416.5,1420,1402,1411.5...
15
by: pukhton | last post by:
Hi fellows Just a quick question about my database. I have one table in my database which i import it from some other Access db. This table has many fields, such as Initials, Medication name...
3
by: shror | last post by:
I was testing to post a form and echo message according to the submitted box using else if and then mail() the box result to myself just for testing the procedure but i got some problems: 1# the...
6
by: lenniekuah | last post by:
Hullo Awesome Helpers, Thank you for helping me earlier. I am back with new problem. I am trying to covert a TEXT String into either Lower and Upper case characterS. (Upper case Eg. ALFRED instead...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.