The document contains 6 sections where each section provides code snippets to solve different programming tasks related to creating user interfaces and performing basic calculations in Visual Basic.NET. The snippets include adding items to listboxes and combo boxes, calculating simple interest and factorials, handling divide by zero errors, and removing items from lists.
The document contains 6 sections where each section provides code snippets to solve different programming tasks related to creating user interfaces and performing basic calculations in Visual Basic.NET. The snippets include adding items to listboxes and combo boxes, calculating simple interest and factorials, handling divide by zero errors, and removing items from lists.
The document contains 6 sections where each section provides code snippets to solve different programming tasks related to creating user interfaces and performing basic calculations in Visual Basic.NET. The snippets include adding items to listboxes and combo boxes, calculating simple interest and factorials, handling divide by zero errors, and removing items from lists.
The document contains 6 sections where each section provides code snippets to solve different programming tasks related to creating user interfaces and performing basic calculations in Visual Basic.NET. The snippets include adding items to listboxes and combo boxes, calculating simple interest and factorials, handling divide by zero errors, and removing items from lists.
Write a program to print the table of given number which is input in a text box, the table is printed in a list box in proper format.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim num, mul As Integer num = TextBox1.Text For i = 1 To 10 mul = num * i ListBox1.Items.Add(mul) Next End Sub End Class 2. Write a program to add a list of student name in combo box by using a input box at runtime, create a remove button to remove the selected item from list.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim name As String name = TextBox1.Text ComboBox1.Items.Add(name) End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click ComboBox1.Items.Remove(ComboBox1.SelectedItem) End Sub End Class 3. Write a program to calculate simple interest by using proper interface.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim p, r, t, i As Integer p = TextBox1.Text r = TextBox2.Text t = TextBox3.Text i = (p * r * t) / 100 TextBox4.Text = i End Sub End Class 4. Write a program to input two numbers if numbers is divided by zero how can we correct this error.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim num1, num2, num3 As Integer num1 = TextBox1.Text num2 = TextBox2.Text Try num3 = num1 / num2 TextBox3.Text = num3 Catch ex As Exception TextBox3.Text = ex.Message End Try End Sub End Class 5. Write a program to create two list box add a name of in first last box at run time add customer name from first list box to second list box also write a program to remove all items from the list box.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim name As String name = TextBox1.Text ListBox1.Items.Add(name) End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click ListBox2.Items.Add(ListBox1.SelectedItem) End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click ListBox2.Items.Clear() End Sub End Class 6. Write a program to input any number and find its factorial value with proper design.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim num, fact As Integer fact = 1 num = TextBox1.Text For i = 1 To num fact = fact * i Next TextBox2.Text = fact End Sub End Class