Bcap 235:: Frmpal Object Eventargs
Bcap 235:: Frmpal Object Eventargs
NET
Lab
PART A
1. Write a program to find the Sum of digit and check palindrome or not. Accept input
through textbox and display the results in label. Also validate for invalid input such
as empty input, nonnumeric and negative integer.
Design
Source Code:
sum = 0
pal = 0
n = Val(txtnumber.Text)
txtnumber.Focus()
t=n
While n <> 0
r = n Mod 10
sum += r
pal = pal * 10 + r
n \= 10
End While
txtsum.Text = sum
If pal = t Then
Else
End If
Else
Exit Sub
End If
End Sub
txtnumber.Text = ""
txtsum.Text = ""
lblpal.Text = ""
End Sub
End Sub
End Class
Output:
2. Create 3 forms Yourself.vb, Yourplace.vb and College.vb where each includes a rich
textbox containing the respective information. Create an MDI form with menu options to
open all these forms as child forms, closing them and rearrange the child forms as follows.
Child Forms Window
For example
Open Cascade
Close Tile Horizontal
Tile vertical
Arrange icons.
Design
Source Code:
Public Class frmmdi
End Sub
End Sub
End Sub
Me.LayoutMdi(MdiLayout.Cascade)
End Sub
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Me.LayoutMdi(MdiLayout.Tilevertical)
End Sub
Me.LayoutMdi(MdiLayout.ArrangeIcons)
End Sub
MDIChildCollege.Close()
MDIChildYourplace.Close()
MDIChildYourself.Close()
Me.Close()
End Sub
End Class
Output:
MDI Form Cascade
Arrange Icon
3. Design a form to accept number of books to be ordered to a shop in a textbox. By clicking a
button ‘Continue’, if accepted number is > 0, then place required number of textboxes on the
form to accept the details Title, Author and Copies, during run time to accept details of
specified number of books. By clicking a button ‘Next’ on this form, enabling progression
bar, send the details to another form to show the summary of the books ordered.
DESIGN:
Source Code
Public Class frmbooks
Dim n, i As Integer
Dim tbt(10) As TextBox
Dim tba(10) As TextBox
Dim tbc(10) As TextBox
Dim lbt, lba, lbc As Label
For i As Integer = 1 To n
tbt(i) = New TextBox
tbt(i).Size = New Size(150, 200)
tbt(i).Location = New Point(200, 200 + 40 * (i + 1))
Me.Controls.Add(tbt(i))
End Sub
End
End Sub
ProgressBar1.Visible = True
Dim j As Integer
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 300
For j = 0 To 300
ProgressBar1.Value = j
Next
frmorderdetails.Show()
frmorderdetails.Controls.Add(lbt)
frmorderdetails.Controls.Add(lba)
frmorderdetails.Controls.Add(lbc)
For i As Integer = 1 To n
frmorderdetails.Controls.Add(tbt(i))
frmorderdetails.Controls.Add(tba(i))
frmorderdetails.Controls.Add(tbc(i))
Next
End Sub
End Class
Output:
4. Create a tree structure using TreeView control with at least 3 nodes with 2 sublevel nodes
under each node. When any node is clicked display the text in a label and when the mouse
pointer moves to this label change the font color by applying the color selected in default
color dialog box. [Use ColorDialog control and MouseMove() event]
Design:
Source Code
Public Class frmtree
End Sub
End Sub
End Class
Output: