0% found this document useful (0 votes)
118 views

Public Class Private Sub As Object As Handles: Form1

This document discusses designing a Windows application using picture box and panel controls in VB.NET. It provides examples of using a toolbar with buttons to change a panel's background color. It also provides exercises to load an image using a picture box and create a dynamic panel with controls at runtime.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views

Public Class Private Sub As Object As Handles: Form1

This document discusses designing a Windows application using picture box and panel controls in VB.NET. It provides examples of using a toolbar with buttons to change a panel's background color. It also provides exercises to load an image using a picture box and create a dynamic panel with controls at runtime.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical No. 11: Design windows application using Picture Box & Panel.

Practical No 11

VIII. Resources required (Additional)


 If any web resources required.

X. Resources used (Additional)


 https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.toolstrip
 https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.panel
 https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.picturebox

XI. Program Code


1. Write a program using Toolbar, Form and Panel Controls.


Public Class Form1


Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles
ToolStripButton1.Click
Panel1.BackColor = Color.Red
End Sub

Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles


ToolStripButton2.Click
Panel1.BackColor = Color.Green
End Sub
End Class

GUI Application Development using VB.Net (22034) Page 1


Practical No. 11: Design windows application using Picture Box & Panel.

XII. Results (output of the program)

XIII. Practical related Questions


1. List the controls which is used to set the icons on the Toolbar Control.
 Following Controls Can be added to ToolStrip / Toolbar.
Button, Label, DropDownButton, SplitButton, Separator, ComboBox, TextBox, and
ProgressBar.
2. Difference between Form and Panel.
Windows Forms Panel controls are used to provide an identifiable grouping for other
controls. Typically, you use panels to subdivide a form by function. The Panel control is
similar to the GroupBox control; however, only the Panel control can have scroll bars, and
only the GroupBox control displays a caption.

XIV. Exercise
1. Write program using picture box control to load an image at run time.


Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.ImageLocation = "E:\www.studyroom.xyz\ON_Bulb.jpg"
PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize
End Sub
End Class

GUI Application Development using VB.Net (22034) Page 2


Practical No. 11: Design windows application using Picture Box & Panel.

OUTPUT:

2. Write a program to demonstrate the use of Panel Control in VB.Net.

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim dynamicPanel As New Panel()
dynamicPanel.Name = "Panel1"
dynamicPanel.Size = New System.Drawing.Size(228, 200)
dynamicPanel.BackColor = Color.Pink

Dim textBox1 As New TextBox()


textBox1.Location = New Point(10, 10)
textBox1.Text = "Enter Your Name"

Dim checkBox1 As New CheckBox()


checkBox1.Location = New Point(10, 50)
checkBox1.Text = "Male"
checkBox1.Size = New Size(200, 30)

Dim checkBox2 As New CheckBox()


checkBox2.Location = New Point(10, 90)
checkBox2.Text = "Male"
checkBox2.Size = New Size(200, 30)

dynamicPanel.Controls.Add(textBox1)

GUI Application Development using VB.Net (22034) Page 3


Practical No. 11: Design windows application using Picture Box & Panel.

dynamicPanel.Controls.Add(checkBox1)
dynamicPanel.Controls.Add(checkBox2)

Controls.Add(dynamicPanel)
End Sub
End Class
OUTPUT:

GUI Application Development using VB.Net (22034) Page 4

You might also like