Create A Select Case Statement To Assign The Per Check Processing Fee?
Apr 8, 2011
I need to create a Select Case statement to assign the per check processing fee:user inputs number of cks into textbox that i need to validate the input if user puts in a negative amount.
10 cents for <=20 cks written ea month
8 cents <= 20 to 39 cks written ea mo
6 cents <= 40 to 59 cks written ea mo
4 cents for 60 or more cks written ea mo.
Also, I have a label programmed to display the $10 monthly fee thats has to be included into the: Total monthly fees.
Here's the coding I have so far:
Const decSERVICE_FEE As Decimal = 10D
Const decTWENTY_OR_LESS_CHECKS As Decimal = 0.1D
Const decTWENTY_THRU_THIRTYNINE_CHECKS As Decimal = 0.08D
When my form loads it adds some handles (using AddHandler) to a sub (showStatus). What this sub does is checks which control activated the sub (using sender.Equals) and displays text in the status label (status) accordingly.For this I use an If...Then statement for each possibility. There are many possibilities and my code get cluttered. Is there a way to do the same thing with a Select...Case statement. I tried: Select Case sender Case tbOne : status.Text = "blahblahblahblahblahblah" End Selectwhere: tbOne is a textbox, status is a StatusLabelIt gives me an error though, saying "Operator '=' is not defined for types 'Object' and 'System.Windows.Forms.TextBox'."Any ideas on how I can get this to work with a select case statement?
i have a program using a select case to convert letters to special charaters. My question is how can I get the code to read upper and lower case letters without having to put the upper case letters in my select case statement. Example: Part of my code is
I just replaced a different segment of code with the select case statement and it works fine. However I don't understand what the dim is for after you do "Select case [variable name here]"
I currently just dimmed a value as nothing. I didn't specify any data type for my variable I'm using for this case statement. But it works.[code]...
I've got the following that has got multiple values of a particular variable and I don't want to stack up to a lot of IF ELSE statements to handle them, so I'd be grateful if some one could very kindly modify the code by using the SELECT CASE statement. Also, I'd like dgMarksEntry.Item(7, i).Value and dgMarksEntry.Item(8, i).Value to handle RANK and COUNT the number of items entered respectively. [Code]
I am not really a fan of if statements. I think they should only be used when comparing different values like this:
Dim status as boolean = false Dim number as integer = 5 if status.equals(true) then
[Code]....
or msgbox on a different line whatever you want.... What is this rule about that select case should only be used if there more then 2-3 options. Is it wrong to use a select case instead?
in combo box string is xxx and yyy and zzz.we have to store the value to each string like xxx=10, yyy=20 and zzz=30. formula is string(xxx)/1.71^(1/2).. if we select xxx formula have to take value 10 or yyy means formula have to take value 20.
am using VB.NET 2008 and am a complete beginner. am writing a programme that requires the user to select a number from a NumericUpDown control and the number selected will enable the equivalent number of GroupBoxes on a form following a click event.
[Code]...
think that the argument to be passed to the method or sub will be the Case condition but how do I return the corresponding code to enable the GroupBoxes? I have the same issue with resetting all my textboxes to some default text then the user activates more then one event.
I am a noob and I am trying to make a simple resistance calculator for practice. I use text boxes to let the user input the current and voltage, and then a combo box for the units and then a list box to display the results. For some reason no matter which units I select it doesn't convert at all. For example 1/2 will always show up as 0.5 in the list box no matter which units are selected from the combo box. Here is my code.....I know that there is more cases but I only put one to see if it
Public Class Form1 Dim unitsA As String Dim unitsV As String
I have trouble of writing the select case statement. I am trying to select the first case to change the labels text and if I select the case again then show up the messagebox.
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Select Case test Case test Label1.Text = "test"
[code]....
When I selected the button which the labels text have changed and I have selected the button again, but the messagebox doesn't appear on the screen.
what is the propert way to use Case statement for;When user click on a button it will show different picture everytime.I do not want a random generator. Just show pictures in order
This error occurs occasionally in Production but I can't reproduce it in DEV
System.NullReferenceException: Object reference not set to an instance of an object. at CommandCenterHeader.ascx.vb:line 23 at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive()
I want to check the current time with the half an hour time slots (total of 48 starts from 00:00,00:30,01:00,....23:30). Is it possible using select case statement.
I am storing the current time in an object.
Dim datime As DateTime = DateTime.Now.ToString("t")
now i need to do conditional check on this variable. under whichever the time slot the variable belongs, i need to write a value under corresponding timeslot.
I'm working through a programming project, which should be quite easy but im stuck right at the start (relatively new to VB). I have a textbox (named textbox1) and a checkbox next to it. I want the checkbox to be ticked (.checked) when ever the value in the textbox is between 1 and 100, the checkbox to not be ticked when theres nothing in there, and for it not to be ticked when the value is < 1 and > 100. Figured a case statement would be the easiest. (this piece of code is just a validation check, basically in the real thing the user would have to enter in a value between 1 and a given number, and need to tell the user if that value is valid).
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Select Case TextBox1.Text Case Is = ""
[code]....
But what happens is, if I enter in the value 1 in the textbox, the checkbox becomes ticked, as it should. It tick with any values between 2 and 99 (any number not starting with 1) but the checkbox becomes ticked again when the value is 100. For any other range, say 1 to 70, the checkbox would be ticked if the value in the textbox is 1 to 7, or any number starting with 1 or 7, but not 8 or 9, or any number starting with 8 or 9.
Is there a way to pass data from a Select Case statement to an array? i.e. I have a gradebook program I'm working on which specifies that I'm to create a form with a menu that will open another form which has textboxes for 5 student names and 5 grades for each. I need to use an array that holds 5 student names (done), an array of 5 strings to hold each students' letter grade (?) and 5 arrays of 5 numbers to hold each student's set of test scores (done). What I can't figure out is how to get th
Public Class StudentData Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
i have a table with information on how much tax a company has to pay, and i need to put it into a select case statement that will let me display the results, but i have no idea how to do that. this is the table:
Sales Income OverBut Not OverCompany Tax IsOf the Amount Over $0 $50,000 1% $0 $50,000 $150,000 $500 + 2% $50,000 $150,000 $300,000 $3,000 + 3% $150,000 $300,000 $500,000 $9,000 + 4% $300,000 $500,000 - $20,000 + 5% $500,000
how do i display this? i have no clue where to start..
While measuring the select case performance I encounter a strange behavior of Select Case statement with the constant expression. I don't understand why its behavior is dependent on the values to be compared.
Im trying to figure how to use the IF, ELSE statements OR the Select Case statement to write this program.I'm using Visual Studio 2010. The program is suppose to allow the user to input their weight in a text box and from group box 1 the select whether theyre male or female using the radios and they select inactive or active from group box two and the calculate but will determine how many calories they should intake based on the criteria below.
I have problem with select case statement. When I click the button, nothing have happens.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim google As String Select Case google Case 0
Dim executeB As Boolean Select Case myVariable Case "a" 'some code Case "b" 'some code Case Else End Select
If myVariable is "a", control will go into the first case statement. Now let's say if myVariable = "a", but inside a's case block, I find that executeB is true, is it then possible to jump to the second case?
I want to be able to have a case for each data system data type. Obviousely the code below doesnt work but it should make it easier to understand my question.
I have a lot of really long strings that I want to test. Is it possible to use the CASE statement and compare it to the first 25 characters of the string to get a match?
[code]How would I switch on an object's type but using VB.NET's Select Case?I'm aware that some might suggest using polymorphism but I'm using a hierarchy of small message classes so that really wouldn't work in my csae.
I need to use a select case statement that evaluates PostDiscountCost based on the value 0 to 999.99, 1000.00 to 1499.99, 1500.00 to 2499.99 and one that doesn't fall within the others. The message box's going to be triggered by the vbYes in the confirm exit message box. Im not asking anyone to do it for me, I just have no idea where to start it, if I need to declare anything else and if I'm on the right track. Code Attached.