Write VB.NET program to add three text boxes at runtime .Allow user to enter values and then display Maximum and Minimum va lue using message box after click on command button
Public Class Form1 Dim a, b, c As Integer Dim t1, t2, t3 As New TextBox Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click t1.Location = New Point(80, 20) t1.Size = New Size(100, 100) Me.Controls.Add(t1) t2.Location = New Point(80, 50) t2.Size = New Size(100, 100) Me.Controls.Add(t2) t3.Location = New Point(80, 80) t3.Size = New Size(100, 100) Me.Controls.Add(t3) End Sub Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub btnMax_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMax.Click a = Val(t1.Text) b = Val(t1.Text) c = Val(t3.Text) If (a > b) Then MsgBox(a & "is Maximum") ElseIf (b > c) Then MsgBox(b & "is Maximum") Else MsgBox(c & "is Maximum") End If End Sub Private Sub btnMin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMin.Click a = Val(t1.Text) b = Val(t2.Text) c = Val(t3.Text) If (a < b) Then MsgBox(a & "is minimum") ElseIf (b < c) Then MsgBox(b & " is minimum") Else MsgBox(c & "is minimum") End If End Sub End Class
Write VB.NET program to add three text boxes at runtime .Allow user to enter values and then display Maximum and Minimum va lue using message box after click on command button
Reviewed by
on
April 27, 2015
Rating: