(5 marks) Create a VB.NET Windows Form Application that does the following: (1)
ID: 3834103 • Letter: #
Question
(5 marks) Create a VB.NET Windows Form Application that does the following: (1) Display two textboxes and a button. The user is expected to input a student’s A-number into the first textbox and input a name into the second textbox. (2) Display a message “XXXXXX’s student A-number is A########” below the button after the user inputs and clicks the button, where XXXXXX and A######## should be the inputted name and A-number respectively. Print your Form1.vb source code. Do NOT print/submit the user interface. 2. (5 marks) Create a VB.NET Windows Form Application that does the following: (1) Display an interface, which includes a textbox and a button, for the user to calculate the HST and total price of a textbook. The user is expected to input a price of a textbook into the textbox. (2) After the user inputs and clicks the button, A. Check if the user inputs a numeric value in the textbox using the IsNumeric(...) function. B. Display a message “Please input the numeric price” below the button if the user’s input in the textbox is not a number. C. Display two messages below the button if otherwise. One message starts with “HST: ” followed by the value of the HST which is 15% of the user’s input in the textbox. The other message starts with “Total: ” followed by the total price which is the sum of the HST and the user’s input in the textbox.
Explanation / Answer
Code for Student Form
--------------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'TB_Name is name of text box where student name is entered
'TB_Anumber is name of text box where student enters number
'Label_msg is name of label filed to display msg on button click
'Button1 name of button name
Label_msg.text=TB_Name.text+ "'s student A-number is A"+TB_Anumber.text
End Sub
---------------------------------------
Code for Textbook price Form
------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'TB_Price is name of text box where price of the text book is entered
'Label_msg is name of label filed to display msg on button click
'Button1 name of button name
If IsNumeric(TB_Price.text) then
Dim price as Integer = CInt( TB_Price.text )
Dim HST as Integer = price*0.15
Dim Total as Integer = price+HST
Label_msg.text= "HST: "+ HST + Environment.NewLine + "Total:"+Total
End Sub
--------------------------------
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.