330 - Visual Basic and C# Programming - R - 2020
330 - Visual Basic and C# Programming - R - 2020
Visual Basic / C#
PROGRAMMING
(330)
REGIONAL – 2020
Production Portion:
Steps:
1. Solution and Project
a. Create a Visual Basic Windows Form Application named
“VB_REG_ContestantNumber” or “CS_REG_ContestantNumber” (depending on
which language you are using). The ContestantNumber is your BPA assigned
contestant number. When naming your project, replace dashes (-) with the
underscore (_). For example, if you BPA contestant number is 98-7654-3210, then
your project name would be VB_REG_98_7654_3210.
2. User Interface
a. The user interface to be constructed as shown in Figure 1. Your application must be
visually identical to the prototype shown in Figure 1.
b. The form’s caption must be set to “Data Storage Conversion”
c. The program is required to use two group boxes.
d. The first group box
i. The caption will be “Convert From”
ii. One label to prompt the user to enter the quantity.
iii. One textbox to take in the user input.
iv. There will need to be five radio buttons for the user to select between Byte,
Kilobit, Megabit, Gigabit and Terabit.
e. The second group box:
i. The caption will be “Convert To”
ii. One label prompting the user to select the data size.
iii. There will need to be five radio buttons for the user to select between Byte,
Kilobit, Megabit, Gigabit and Terabit.
iv. One button with the text of Convert
v. One textbox to display the converted data amount
f. Below the two group boxes, there will be a single button for exit.
Visual Basic / C# PROGRAMMING – REGIONAL 2020
Page 3 of 5
3. Program Execution
a. The program should user validate all input and create an error message if any of the
user’s input is missing without stopping the program’s execution. See Figure 2.
b. The program should validate that the value in the textbox located in the “Convert
From” section contains a number.
c. With all the given input, the program should calculate and display the conversion to
the textbox within the “Convert To” group box.
i. All output can be rounded to the 15th decimal place.
ii. See Figure 3
d. The program should exit when the user clicks the “Exit” button.
4. The Source Code
a. To keep all the company’s programs consistent, the following naming conventions
must be used:
i. The following prefixes should be used in naming the following:
1. Forms – frm, Group_Boxes – grp, Labels – lbl, Textboxes – txt,
Radio_Buttons – rb and Buttons – btn.
ii. No single letter variables are to be used in the program.
b. The program must be commented throughout, especially all functions and methods.
Figure 1
Visual Basic / C# PROGRAMMING – REGIONAL 2020
Page 4 of 5
Figure 2
Figure 3
Visual Basic / C# PROGRAMMING – REGIONAL 2020
Page 5 of 5
Program Execution
Code copied to USB drive and program runs from USB ____ 30 pts
If the program does not execute, then the remaining items in this section receive a score of zero.
Form has the correct caption (Data Storage Conversion) ____ 15 pts
The form is divided using two group boxes with the correct captions (10 per) ____ 20 pts
The radio buttons are evenly spaced vertically ____ 30 pts
Exit button is present and works correctly ____ 15 pts
Error message occur if any/all of the input is missing (20 points per input) ____ 60 pts
Error message occurs if a number is not entered in the convert from textbox ____ 20
Program calculates and displays the correct conversion ____ 60 pts
Source
VISUAL BASIC/
C# PROGRAMMING
(330)
REGIONAL 2020
Production Portion:
Steps:
1. Solution and Project
a. Create a Visual Basic Windows Form Application named
“VB_REG_ContestantNumber” or “CS_REG_ContestantNumber” (depending on
which language you are using). The ContestantNumber is your BPA assigned
contestant number. When naming your project, replace dashes (-) with the
underscore (_). For example, if you BPA contestant number is 98-7654-3210, then
your project name would be VB_REG_98_7654_3210.
2. User Interface
a. The user interface to be constructed as shown in Figure 1. Your application must be
visually identical to the prototype shown in Figure 1.
b. The form’s caption must be set to “Data Storage Conversion”
c. The program is required to use two group boxes.
d. The first group box
i. The caption will be “Convert From”
ii. One label to prompt the user to enter the quantity.
iii. One textbox to take in the user input.
iv. There will need to be five radio buttons for the user to select between Byte,
Kilobit, Megabit, Gigabit and Terabit.
e. The second group box:
i. The caption will be “Convert To”
ii. One label prompting the user to select the data size.
iii. There will need to be five radio buttons for the user to select between Byte,
Kilobit, Megabit, Gigabit and Terabit.
iv. One button with the text of Convert
v. One textbox to display the converted data amount
f. Below the two group boxes, there will be a single button for exit.
Visual Basic / C# PROGRAMMING – REGIONAL 2020
Page 3 of 11
3. Program Execution
a. The program should user validate all input and create an error message if any of the
user’s input is missing without stopping the program’s execution. See Figure 2.
b. The program should validate that the value in the textbox located in the “Convert
From” section contains a number.
c. With all the given input, the program should calculate and display the conversion to
the textbox within the “Convert To” group box.
i. All output can be rounded to the 15th decimal place.
ii. See Figure 3
d. The program should exit when the user clicks the “Exit” button.
4. The Source Code
a. To keep all the company’s programs consistent, the following naming conventions
must be used:
i. The following prefixes should be used in naming the following:
1. Forms – frm, Group_Boxes – grp, Labels – lbl, Textboxes – txt,
Radio_Buttons – rb and Buttons – btn.
ii. No single letter variables are to be used in the program.
b. The program must be commented throughout, especially all functions and methods.
Figure 1
Visual Basic / C# PROGRAMMING – REGIONAL 2020
Page 4 of 11
Figure 2
Figure 3
Visual Basic / C# PROGRAMMING – REGIONAL 2020
Page 5 of 11
Program Execution
Code copied to USB drive and program runs from USB ____ 30 pts
If the program does not execute, then the remaining items in this section receive a score of zero.
Form has the correct caption (Data Storage Conversion) ____ 15 pts
The form is divided using two group boxes with the correct captions (10 per) ____ 20 pts
The radio buttons are evenly spaced vertically ____ 30 pts
Exit button is present and works correctly ____ 15 pts
Error message occur if any/all of the input is missing (20 points per input) ____ 60 pts
Error message occurs if a number is not entered in the convert from textbox ____ 20
Program calculates and displays the correct conversion ____ 60 pts
Source
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Namespace Data_Storage
Public Partial Class frmDataConversion
Inherits Form
Return bStatus
End Function
If bValidFrom Then
fromVal = Int32.Parse(txtFrom.Text)
If rbFromB.Checked Then
cvToBytes = fromVal
ElseIf rbFromKb.Checked Then
cvToBytes = 1024 * fromVal
ElseIf rbFromMb.Checked Then
cvToBytes = Math.Pow(1024, 2) * fromVal
ElseIf rbFromGb.Checked Then
cvToBytes = Math.Pow(1024, 3) * fromVal
ElseIf rbFromTb.Checked Then
cvToBytes = Math.Pow(1024, 4) * fromVal
End If
If rbToB.Checked Then
cvToNew = cvToBytes
ElseIf rbToKb.Checked Then
cvToNew = cvToBytes / Math.Pow(1024, 1)
ElseIf rbToMb.Checked Then
cvToNew = cvToBytes / Math.Pow(1024, 2)
ElseIf rbToGb.Checked Then
cvToNew = cvToBytes / Math.Pow(1024, 3)
ElseIf rbToTb.Checked Then
cvToNew = cvToBytes / Math.Pow(1024, 4)
End If
txtConvert.Text = cvToNew.ToString("N15")
Else
MessageBox.Show("Input error, please correct and retry.")
End If
End Sub
namespace Data_Storage
{
public partial class frmDataConversion : Form
{
public frmDataConversion()
{
InitializeComponent();
}
}
}
if (rbFromB.Checked == false && rbFromKb.Checked == false &&
rbFromMb.Checked == false && rbFromGb.Checked == false &&
rbFromTb.Checked == false )
{
errorProvider3.SetError(rbFromKb, "Please select a from data type.");
Visual Basic / C# PROGRAMMING – REGIONAL 2020
Page 10 of 11
bStatus = false;
}
else
{
errorProvider3.SetError(rbFromKb, "");
else
{
errorProvider2.SetError(lblDirections, "");
}
return bStatus;
}
if (rbToB.Checked)
{
cvToNew = cvToBytes;
}
else if (rbToKb.Checked)
{
cvToNew = cvToBytes/ Math.Pow(1024, 1);
}
else if (rbToMb.Checked)
{
cvToNew = cvToBytes / Math.Pow(1024, 2) ;
}
else if (rbToGb.Checked)
{
cvToNew = cvToBytes / Math.Pow(1024, 3) ;
}
else if (rbToTb.Checked)
{
cvToNew = cvToBytes / Math.Pow(1024, 4) ;
}
}
else
{
MessageBox.Show("Input error, please correct and retry.");
}
}