Lesson 6 Introduction to Human Computer Interaction.pptx
EllenGracePorras
15 views
12 slides
Jul 16, 2024
Slide 1 of 12
1
2
3
4
5
6
7
8
9
10
11
12
About This Presentation
Lesson 6 Introduction to HCI.pptx
Size: 1.28 MB
Language: en
Added: Jul 16, 2024
Slides: 12 pages
Slide Content
Introduction to HCI Instructor: Ellen Grace Porras
Visual Basic.Net 2 If Statements Radio Buttons CheckBox ListBox
If Statements/Conditions Use the if statement to specify a block of code to be executed if a condition is true . Use the else statement to specify a block of code to be executed if the condition is false . Use the elseif statement to specify a new condition if the first condition is false . 3
Let’s try: Math Functions 4 10 First Number: Compute Second Number: 5 Add Sub Multiply Divide Message Box //Answer here 10 Instead of using buttons, let us use Combo Box
Let’s try: Math Functions Dim num1, num2, answer as Decimal num1 = TextBox1.Text num2 = TextBox2.Text If ComboBox1.Text = "Add" Then answer = num1 + num2 MessageBox.Show( "The Sum is: " & answer) ElseIf ComboBox1.Text = "Sub" Then answer = num1 - num2 MessageBox.Show( "The difference is: " & answer) End If 5 Message Box //Answer here 10 10 First Number: Compute Second Number: 5 Add Sub Multiply Divide
Let’s try: Math Functions ElseIf ComboBox1.Text = “multiply" Then answer = num1 * num2 MessageBox.Show( "The product is: " & answer) ElseIf ComboBox1.Text = “divide" Then answer = num1 / num2 MessageBox.Show( "The quotient is: " & answer) End If 6 Message Box //Answer here 10 10 First Number: Compute Second Number: 5 Add Sub Multiply Divide
Radio Button Syntax: If RadioButton1.Checked = True Then MessageBox.Show ( "Welcome First Year!" ) ElseIf RadioButton2.Checked = True Then MessageBox.Show ( "Hello Second Year!" ) End If 7 First Year Submit Second Year Message Box //Answer here Welcome First Year!
Radio Button Syntax: If RadioButton1.Checked = True Then MessageBox.Show ( "Welcome First Year!" ) ElseIf RadioButton2.Checked = True Then MessageBox.Show ( "Hello Second Year!" ) ElseIf RadioButton3.Checked = True Then MessageBox.Show ( "Almost There Third Year!" ) ElseIf RadioButton4.Checked = True Then MessageBox.Show ( "Congratulations!" ) End If 8 First Year Submit Second Year Third Year Fourth Year Message Box //Answer here Hello Second Year!
9 Check your Knowledge Declare a variable firstname , Lastname and Fullname as String. Show the output using MessageBox with a text your “ fullname is: “ and add your gender. firstname = txt1.Text lastname = txt2.Text fullname = txt1.Text + " " + txt2.Text If RadioButton1.Checked = True Then MessageBox.Show( "Your fullname is: " + fullname + " Your Gender is: " + "Male" ) ElseIf RadioButton2.Checked = True Then MessageBox.Show( "Your fullname is: " + fullname + " Your Gender is: " + "Female" ) End If
10 Check your Knowledge Declare a variable firstname , Lastname and Fullname as String. Show the output using Textbox with a text your fullname is: and add your gender firstname = txt1.Text lastname = txt2.Text fullname = txt1.Text + " " + txt2.Text If RadioButton1.Checked = True Then Textbox3.text= "Your fullname is: " + fullname + " Your Gender is: " + "Male" ElseIf RadioButton2.Checked = True Then Textbox3.text= "Your fullname is: " + fullname + " Your Gender is: " + RadioButton2.Text End If
Checkbox Syntax: If CheckBox1.Checked = True Then MessageBox.Show ( “Hello BSIT!" ) End If If CheckBox2.Checked = True Then MessageBox.Show ( “Hello BSHM!” ) End If 11 BSIT Submit BSHM
Thank you Presenter name: Ellen Grace D. Porras Email address: [email protected]