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
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?
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 would i go about answering this? Select the range the PH will fall into for...
How would i go about answering this? Select the range the PH will fall into for each .1M solution. a. MnCl3 <1 1 between 1&7 7 between 7&13 13 >13 b. CH3CO2H <1 1 between 1&7 7 between 7&13 13 >13 c. KOH <1 1 between 1&7 7 between 7&13 13 >13 d. NaF <1 1 between 1&7 7 between 7&13 13 >13
Using If-Else conditional statement write a Visual Basic Program to display: (i) “STOP” if the user...
Using If-Else conditional statement write a Visual Basic Program to display: (i) “STOP” if the user enters “R” (ii) “CAUTION” if the user enters “Y” (iii) “GO” if the user enters “G” (iv) “Invalid” if the user enters any other character
In c# I need to create a simple payroll management system using visual basic and GUI....
In c# I need to create a simple payroll management system using visual basic and GUI. I also need to connect to SQL database. It needs a log in screen, inside the login screen it needs another screen to enter or edit employee information. It needs somewhere to enter hours worked for that specific employee, and another screen that can access reports.
How would I go about this question? Discuss, and give real world examples of how scarcity,...
How would I go about this question? Discuss, and give real world examples of how scarcity, decision making, and opportunity cost relate.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT