126VBDOTNET
126VBDOTNET
1. Develop GUI application to book a ticket and calculate a total number of booked tickets
without using database.
ANSWER :
Public Class Ass_1
End Sub
End Class
OUTPUT :
1
SYBCA DIV – 02 .NET PROGRAMMING 126
If lblm.Checked Then
Assignment_1.registration_detail.Label1.Text += lblgender.Text + lblm.Text + vbCrLf +
lblhobbies.Text
Else
Assignment_1.registration_detail.Label1.Text += lblgender.Text + lblf.Text + vbCrLf +
lblhobbies.Text
End If
2
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
3
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
Sub checkwinner()
If ((Button1.Text = Button2.Text And Button2.Text = Button3.Text And Button1.Text <> ""
And Button2.Text <> "" And Button3.Text <> "") Or _
(Button4.Text = Button5.Text And Button5.Text = Button6.Text And Button4.Text <> "" And
Button5.Text <> "" And Button6.Text <> "") Or _
4
SYBCA DIV – 02 .NET PROGRAMMING 126
(Button7.Text = Button8.Text And Button8.Text = Button9.Text And Button7.Text <> "" And
Button8.Text <> "" And Button9.Text <> "") Or _
(Button1.Text = Button4.Text And Button4.Text = Button7.Text And Button1.Text <> "" And
Button4.Text <> "" And Button7.Text <> "") Or _
(Button2.Text = Button5.Text And Button5.Text = Button8.Text And Button2.Text <> "" And
Button5.Text <> "" And Button8.Text <> "") Or _
(Button3.Text = Button6.Text And Button6.Text = Button9.Text And Button3.Text <> "" And
Button6.Text <> "" And Button9.Text <> "") Or _
(Button1.Text = Button5.Text And Button5.Text = Button9.Text And Button1.Text <> "" And
Button5.Text <> "" And Button9.Text <> "") Or _
(Button3.Text = Button5.Text And Button5.Text = Button7.Text And Button3.Text <> "" And
Button5.Text <> "" And Button7.Text <> "")) Then
Sub clearcontrol()
Button1.Text = ""
Button2.Text = ""
Button3.Text = ""
Button4.Text = ""
Button5.Text = ""
Button6.Text = ""
Button7.Text = ""
Button8.Text = ""
Button9.Text = ""
Label1.Text = "player 1 : X"
End Sub
End Class
5
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
Dim a As Double = 0
Dim sign As String
Dim opt As Integer = 0
6
SYBCA DIV – 02 .NET PROGRAMMING 126
TextBox1.Clear()
a=0
sign = ""
opt = 0
End Sub
Sub calculate()
Select Case sign
Case "+"
TextBox1.Text = Convert.ToString(a + Double.Parse(TextBox1.Text))
Case "-"
TextBox1.Text = Convert.ToString(a - Double.Parse(TextBox1.Text))
Case "*"
TextBox1.Text = Convert.ToString(a * Double.Parse(TextBox1.Text))
Case "/"
TextBox1.Text = Convert.ToString(a / Double.Parse(TextBox1.Text))
Case "mod"
TextBox1.Text = Convert.ToString(a Mod Double.Parse(TextBox1.Text))
Case "sqrt"
If TextBox1.Text <> 0 Then
TextBox1.Text =
Convert.ToString(System.Math.Sqrt(Convert.ToDouble(TextBox1.Text)))
End If
End Select
End Sub
7
SYBCA DIV – 02 .NET PROGRAMMING 126
End Sub
8
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
9
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
10
SYBCA DIV – 02 .NET PROGRAMMING 126
11
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
12
SYBCA DIV – 02 .NET PROGRAMMING 126
13
SYBCA DIV – 02 .NET PROGRAMMING 126
14
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
Mouse Event
Public Class Ass_12
15
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
End Sub
Try
a1 = TextBox1.Text
b1 = TextBox2.Text
total1 = a1 / b1
MessageBox.Show(total1)
Catch ex As Exception
MessageBox.Show("divide by zero error", "structure")
End Try
16
SYBCA DIV – 02 .NET PROGRAMMING 126
End Sub
End Class
OUTPUT :
17
SYBCA DIV – 02 .NET PROGRAMMING 126
Me.RadioButton3.Checked = True
TextBox1.Text = "Default"
End Sub
ComboBox1.Items.Add("Earth")
ComboBox1.Items.Add("Mercury")
ComboBox1.Items.Add("Mars")
ComboBox1.Items.Add("Jupiter")
ComboBox1.Items.Add("Venus")
ComboBox1.Items.Add("Neptune")
ComboBox1.Items.Add("Uranus")
CheckedListBox1.Items.Add("Earth")
CheckedListBox1.Items.Add("Mercury")
18
SYBCA DIV – 02 .NET PROGRAMMING 126
CheckedListBox1.Items.Add("Mars")
CheckedListBox1.Items.Add("Jupiter")
CheckedListBox1.Items.Add("Venus")
CheckedListBox1.Items.Add("Neptune")
CheckedListBox1.Items.Add("Uranus")
End Sub
19
SYBCA DIV – 02 .NET PROGRAMMING 126
RichTextBox1.SelectionStart = 14
RichTextBox1.SelectionLength = 19
RichTextBox1.SelectionColor = Color.Blue
RichTextBox1.SelectionFont = New Font("Arial", 12, FontStyle.Bold)
End Sub
20
SYBCA DIV – 02 .NET PROGRAMMING 126
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
End Sub
End Class
OUTPUT :
21
SYBCA DIV – 02 .NET PROGRAMMING 126
If TreeView1.Nodes(0).Nodes(0).IsSelected Then
Ass_1.Show()
End If
If TreeView1.Nodes(0).Nodes(1).IsSelected Then
Ass_2.Show()
End If
If TreeView1.Nodes(1).Nodes(0).IsSelected Then
Ass_3.Show()
End If
If TreeView1.Nodes(1).Nodes(1).IsSelected Then
Ass_4.Show()
End If
If TreeView1.Nodes(1).Nodes(2).IsSelected Then
Ass_5.Show()
End If
End Sub
End Class
OUTPUT :
If clickCount = 3 Then
22
SYBCA DIV – 02 .NET PROGRAMMING 126
23
SYBCA DIV – 02 .NET PROGRAMMING 126
False)
Me.Text = SaveFileDialog1.FileName
End If
End Sub
24
SYBCA DIV – 02 .NET PROGRAMMING 126
TextBox1.SelectAll()
End Sub
25
SYBCA DIV – 02 .NET PROGRAMMING 126
22. Develop GUI application which accept for an employee of a company accept personal details,
salary information using separate interactive forms store the information in database provide
save, view, navigation commands also provide search facility based on employee code. Also
display salary information for all departments wise.
ANSWER :
EMP Class
Imports System.Data.OleDb
Dim cm As OleDbCommand
Dim da As OleDbDataAdapter
Dim ds As New DataSet
cn.Close()
End Sub
FILE CODING :
Imports System.Data.OleDb
26
SYBCA DIV – 02 .NET PROGRAMMING 126
Dim cm As OleDbCommand
cmbdepart.DisplayMember = "dname"
cmbdepart.ValueMember = "did"
FillStudentData()
End Sub
FillStudentData()
clearControls()
End Sub
maxrow = ds.Tables(0).Rows.Count
End Sub
s1.IUD("Update emp1 set eadd ='" & teadd.Text & "',esalary ='" & tsalary.Text &
"',ename='" & tename.Text & "',ephone='" & tephone.Text & "',gender='" & gender &
"',did=" & cmbdepart.SelectedValue & " where eid=" & teid.Text)
27
SYBCA DIV – 02 .NET PROGRAMMING 126
FillStudentData()
clearControls()
End Sub
FillStudentData()
clearControls()
End Sub
teid.Text = DataGridView1.Rows(inc).Cells(0).Value
tename.Text = DataGridView1.Rows(inc).Cells(1).Value
tsalary.Text = DataGridView1.Rows(inc).Cells(3).Value
teadd.Text = DataGridView1.Rows(inc).Cells(4).Value
tephone.Text = DataGridView1.Rows(inc).Cells(5).Value
gender = DataGridView1.Rows(inc).Cells(2).Value
If gender = "Male" Then
rbMale.Checked = True
ElseIf gender = "Female" Then
rbFemale.Checked = True
28
SYBCA DIV – 02 .NET PROGRAMMING 126
End If
cmbdepart.Text = DataGridView1.Rows(inc).Cells(6).Value
End Sub
29
SYBCA DIV – 02 .NET PROGRAMMING 126
cmbdepart.Text = ds.Tables(0).Rows(inc).Item(6)
End Sub
End Class
DataFilter
cmbdepart.DisplayMember = "dname"
cmbdepart.ValueMember = "did"
End Sub
End Class
OUTPUT :
30
SYBCA DIV – 02 .NET PROGRAMMING 126
INSERT :
UPDATE :
DELETE :
31
SYBCA DIV – 02 .NET PROGRAMMING 126
FILTER :
32
SYBCA DIV – 02 .NET PROGRAMMING 126
mports System.Data.OleDb
Public Class Form1
Dim ds As New DataSet
Dim maxrow, inc As Integer
Dim cm As OleDbCommand
Dim lb As New Library
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles
MyBase.Load
ds = lb.Display("select * from Book")
ComboBox1.DataSource = ds.Tables(0)
ComboBox1.DisplayMember = "bname"
ComboBox1.ValueMember = "bid"
FillStudentData()
End Sub
Private Sub FillStudentData()
ds = lb.Display("selects.sid,s.rno,s.sname,s.class,s.div,s.idate,s.rdate,b.bname from
Student s,Book b where s.sid=b.sid order by rno")
DataGridView1.DataSource = ds.Tables(0)
DataGridView1.Columns(0).Visible = False
maxrow = ds.Tables(0).Rows.Count
End Sub
Private Sub ClearControl()
tbrno.Text = ""
tbrno.Enabled = True
tbname.Text = ""
tbclass.Text = ""
tbdiv.Text = ""
tbidate.Text = ""
tbrdate.Text = ""
ComboBox1.Text = ""
End Sub
Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e
AsSystem.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
inc = e.RowIndex tbrno.Enabled = False
tbsid.Text = DataGridView1.Rows(inc).Cells(0).Value
tbrno.Text = DataGridView1.Rows(inc).Cells(1).Value
tbname.Text = DataGridView1.Rows(inc).Cells(2).Value
tbclass.Text = DataGridView1.Rows(inc).Cells(3).Value
tbdiv.Text = DataGridView1.Rows(inc).Cells(4).Value
tbidate.Text = DataGridView1.Rows(inc).Cells(5).Value
tbrdate.Text = DataGridView1.Rows(inc).Cells(6).Value
End Sub
Private Sub btninsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btninsert.Click
lb.IUD("Insert into Student (rno,sname,class,div,idate,rdate) values (" & tbrno.Text &
33
SYBCA DIV – 02 .NET PROGRAMMING 126
",'" & tbname.Text & "','" & tbclass.Text & "','" & tbdiv.Text & "','" & tbidate.Text &
"','" & tbrdate.Text & "')")
FillStudentData()
ClearControl()
End Sub
Private Sub btnupdate_Click(sender As System.Object, e As System.EventArgs) Handles
btnupdate.Click
lb.IUD("Update Student set sname='" & tbname.Text & "',class='" & tbclass.Text &
"',div=" & tbdiv.Text & ",idate='" & tbidate.Text & "',rdate='" & tbrdate.Text &
"',book=" & ComboBox1.SelectedValue & " where rno=" & tbrno.Text)
FillStudentData()
ClearControl()
End Sub
Private Sub btndelete_Click(sender As System.Object, e As System.EventArgs) Handles
btndelete.Click
lb.IUD("delete * from Student where rno=" & tbrno.Text)
FillStudentData()
ClearControl()
End Sub
Private Sub btnsearch_Click(sender As System.Object, e As System.EventArgs) Handles
btnsearch.Click
Search.Show()
End Sub
Private Sub btnexit_Click(sender As System.Object, e As System.EventArgs) Handles
btnexit.Click
Me.Close()
End Sub
Private Sub btnacs_Click(sender As System.Object, e As System.EventArgs) Handles
btnacs.Click
Dim oview As New DataView(ds.Tables(0))
oview.Sort = "rno Asc"
DataGridView1.DataSource = oview
End Sub
Private Sub btndesc_Click(sender As System.Object, e As System.EventArgs) Handles
btndesc.Click
Dim oview As New DataView(ds.Tables(0))
oview.Sort = "rno Desc"
DataGridView1.DataSource = oview
End Sub
Private Sub btnfirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnfirst.Click
inc = 0
DisplayRecord()
End Sub
Private Sub btnprev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
34
SYBCA DIV – 02 .NET PROGRAMMING 126
Handles btnprev.Click
If inc = 0 Then
MessageBox.Show("First Record...!!!")
Else
inc -= 1
DisplayRecord()
End If
End Sub
Private Sub btnnext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnnext.Click
If inc = maxrow - 1 Then
MessageBox.Show("Last Record...!!!")
Else
inc += 1
DisplayRecord()
End If
End Sub
Private Sub btnlast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnlast.Click
inc = maxrow - 1
DisplayRecord()
End Sub
Private Sub DisplayRecord()
tbsid.Text = ds.Tables(0).Rows(inc).Item(0)
tbrno.Text = ds.Tables(0).Rows(inc).Item(1)
tbname.Text = ds.Tables(0).Rows(inc).Item(2)
tbclass.Text = ds.Tables(0).Rows(inc).Item(3)
tbdiv.Text = ds.Tables(0).Rows(inc).Item(4)
tbidate.Text = ds.Tables(0).Rows(inc).Item(5)
tbrdate.Text = ds.Tables(0).Rows(inc).Item(6)
ComboBox1.Text = ds.Tables(0).Rows(inc).Item(7)
End Sub
End Class
35
SYBCA DIV – 02 .NET PROGRAMMING 126
OUTPUT :
ASCENDING :
DECENDING :
36
SYBCA DIV – 02 .NET PROGRAMMING 126
SEARCH :
37
SYBCA DIV – 02 .NET PROGRAMMING 126
38