2 by Sachinraj
2 by Sachinraj
2 by Sachinraj
CAP 407
MODERN PROGRAMMING TOOLS & TECHNIQUES III
SUBMITTED TO-
Sarabjit Sir
SUBMITTED BY-
SACHIN RAJ
B34
D3901
PART- A
Q 1. Create a window based application to display a message box
with Yes/No/Cancel buttons, icon of warning. Perform different
operations when user clicks on “Yes”, “No” and “Cancel” using
dialog result.
Ans-
Public Class Form1
End Sub
End Class
Q 2. Create a windows based application to read student_name,
reg_no, date of admission, graduate and undergraduate_course
using textbox, date and time picker, radio button etc. Store
these data in file and display the same from file? (Using Text
Mode)
Ans-
Imports System.IO
End Sub
MessageBox.Show("UnGraduate Man")
End If
End Sub
End Sub
End Sub
End Class
End If
End Sub
End Sub
End Sub
con.Open()
con.Close()
End Sub
End Class
Database Table
PART –B
End Sub
Q 5. Create a window based application to read data of a student
for placement registration. Send this data to a file and read it
from same file. (Using Binary Mode)
Ans-
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.Focus()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim fs As New FileStream("d:\Binary1.txt", FileMode.Create,
FileAccess.Write)
Dim bwriter As New BinaryWriter(fs)
bwriter.Write(TextBox1.Text)
MessageBox.Show("Your file has been saved...")
fs.Close()
TextBox1.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button2.Click
Dim fs As New FileStream("d:\Binary1.txt", FileMode.Open,
FileAccess.Read)
Dim breader As New BinaryReader(fs)
TextBox2.Text = breader.Read()
breader.Close()
fs.Close()
End Sub
End Class
Q 6. Create a window based application to read & write data of a
patient in a XML file and read it from same file using fields
like
Reg.no.
Patient Name
Dr. Reffered
Diagnose
Ans-
Imports System.Xml
Public Class Form1
writer.WriteStartElement("root")
writer.WriteStartElement("r", "RECORD", "urn:record")
writer.WriteStartElement("Patient Registration number:", "")
writer.WriteString("10902778")
writer.WriteStartElement("Paitent Name:", "")
writer.WriteString(" Navneet Mishra")
writer.WriteStartElement("Doctor Refered:", "")
writer.WriteString(" Anuj Mehta")
writer.WriteStartElement("Diagnose:", "")
writer.WriteString(" Eye Problem ")
writer.WriteEndElement()
writer.WriteEndDocument()
writer.Close()
MessageBox.Show("File Has Been Created In Ur Drive")
End Sub
End Class