Question

In: Computer Science

using visual basic how would i go about coding: if checkbox 1 is checked add 10...

using visual basic

how would i go about coding:
if checkbox 1 is checked add 10 to subtotal

if checkbox 2 is checked add 50 to subtotal

if checkbox 3 is checked add 100 to subtotal

subtotal label is 'lblSubtotal'

all 3 boxes are independent.
example if checkboxes 1 and 3 are checked 110 would be added to subtotal.

Solutions

Expert Solution

Program

Public Class Form1

    'Declare a variable Subtotal

    Dim Subtotal As Integer = 0

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub chk10_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chk10.CheckedChanged

        'Checking Checkbox1 is checked or not

        If chk10.Checked = True Then

            Subtotal = 10 'add 10 to Subtotal

            lblSubtotal.Text = Convert.ToString(Subtotal)

        End If

    End Sub

    Private Sub chk50_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chk50.CheckedChanged

        'Checking Checkbox2 is checked or not

        If chk50.Checked = True Then

            Subtotal = Subtotal + 50 'add 50 to Subtotal

            lblSubtotal.Text = Convert.ToString(Subtotal)

        End If

    End Sub

    Private Sub chk100_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chk100.CheckedChanged

        'Checking Checkbox3 is checked or not

        If chk100.Checked = True Then

            Subtotal = Subtotal + 100 'add 100 to Subtotal

            lblSubtotal.Text = Convert.ToString(Subtotal)

        End If

    End Sub

End Class

Output Screenshot


Related Solutions

There are 50 parts that are checked using a GO-NOGO gauge. A GO reading would be...
There are 50 parts that are checked using a GO-NOGO gauge. A GO reading would be considered a pass (or success) for the part. What is the probability that 37 parts will successfully pass? Given the following table determine the mean and standard deviation Score Frequency 0-8 15 9-17 3 18-26 25 27-35 4 36-44 3
NOTE: This is done using Visual Basic. Create an application named You Do It 1. Add...
NOTE: This is done using Visual Basic. Create an application named You Do It 1. Add a text box, a label, and a button to the form. The button’s Click event procedure should store the contents of the text box in a Double variable named dblCost. It then should display the variable’s contents in the label. Enter the three Option statements above the Public Class clause in the Code Editor window, and then code the procedure. Save the solution and...
How would I go about making a simple code for an analog clock using matlab?
How would I go about making a simple code for an analog clock using matlab?
I am trying to write code for a program in Visual Studo using Visual Basic programming...
I am trying to write code for a program in Visual Studo using Visual Basic programming language that computes the factorial of an entered number by using a For Loop. My problem is that it keeps re-setting the variable for Factorial. Below is my code if anyone can help. I want it to multiply the given number by that number - 1, then continuing to do so until it hits zero without multiplying by zero. Private Sub BtnCalculate_Click(sender As Object,...
NOTE: This is done using Visual Basic. Create an application named You Do It 2. Add...
NOTE: This is done using Visual Basic. Create an application named You Do It 2. Add a text box, a label, and a button to the form. Enter the following three Option statements above the Public Class clause in the Code Editor window: Option Explicit On, Option Strict Off, and Option Infer Off. In the button’s Click event procedure, declare a Double variable named dblNum. Use an assignment statement to assign the contents of the text box to the Double...
How would I go about this question using R studio? In a multiple regression, investigate whether...
How would I go about this question using R studio? In a multiple regression, investigate whether the categorical variable "Type" has a statistically significant interaction effect with any of the other covariates, A, B, C and D. Of those interactions that are statistically significant (if any), determine which one has the most impact on the model and add it to your model. Please include general 'formulas' for the commands needed!
C++ Code! This code was written/implemented using the "class format." How would I go about in...
C++ Code! This code was written/implemented using the "class format." How would I go about in converting it to the "struct format?" #include <iostream> #include <iomanip> using namespace std; class ListNode{ public: string course_name; string course_number; string course_room; ListNode* next; ListNode(){ this->next = NULL; } ListNode(string name, string number, string room){ this->course_name = name; this->course_number = number; this->course_room = room; this->next = NULL; } }; class List{ public: ListNode* head; List(){ this->head = NULL; } void insert(ListNode* Node){ if(head==NULL){ head...
If I were using a visual aid for a speech atcollegegraduation, Which visual aid would be...
If I were using a visual aid for a speech atcollegegraduation, Which visual aid would be best and why?          
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax...
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax Application 1.1 Problem Statement Due to upcoming end of financial year, you are being called in to write a program which will read in a file and produce reports as outlined. Inputs: The input file called IncomeRecord.txt contains a list of Annual income records of employees in a firm. Each record is on a single line and the fields are separated by spaces. The...
how can i convert this to work in visual basic ? what are the formulas for...
how can i convert this to work in visual basic ? what are the formulas for that? You must create a Windows Forms application as the Conversion project including a picture of money on your form.  Create a textbox for the user to entry a dollar amount. Determine the number of quarters, dimes, nickels, and pennies using label controls to display the results.  In your calculation, you should use constant variables. ex) Enter dollar amount for conversion of 4.69 Number...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT