Monday, 4 April 2016

Create,Save,Update,Delete and Search Student Profile Using Visual Basic ...

How to create ,Save,Update ,Delete and Search Student Profile information using Visual basic and Ms Access-Step By Step
VB6 Control used are Textbox,  OptionBox,Combobox,Picturebox,DatePicker ,Common Dialog controls
Features of Application are:
1.How to design the VB form and add various controls i.e Textbox,  OptionBox,Combobox,Picturebox,DatePicker ,Common Dialog controls onto the form.
2.How to create database object at run time and do the database connectivity.
3.How to load the image onto the form using commondialog control and also  Save /Retrieve  the Image or Picture from the database.
4.How to save the values selected from Optionbox and Combobox into the database and retrieve them when required.
5.How to Use datepicker control and Save the Date into the Database.
6.How to Save ,Delete,Update and Search the Student profiles.
7.How to navigate between the profiles (First/Next/Previous/Last).

if you like my work,Please hit like button and SUBSCRIBE to my channel.

CODE FOR THIS APPLICATION:

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str As String
Dim confirm As Integer

CODE FOR ADD NEW PROFILE
Private Sub addnew_Click()
rs.addnew
clear
End Sub
Sub clear()
Text1.Text = ""
Text2.Text = ""
DTPicker1.Value = "10/05/2005"
Option1.Value = False
Option2.Value = False
Combo1.Text = "Select Department"
Combo2.Text = "Select Course"
Combo3.Text = "Select Semester"
Text3.Text = ""
Text4.Text = ""
Picture1.Picture = LoadPicture("")
End Sub
CODE FOR COMBOBOX SELECT OPTIONS
Private Sub Combo1_Click()
Combo2.clear
If Combo1.Text = "Computer Science" Then
Combo2.AddItem "M.C.A"
Combo2.AddItem "B.C.A"
Combo2.AddItem "B.Sc(IT)"
ElseIf Combo1.Text = "Electrical Engineering" Then
Combo2.AddItem "B.TECH (EE)"
Combo2.AddItem "M.TECH (EE)"
ElseIf Combo1.Text = "Civil Engineering" Then
Combo2.AddItem "B.TECH (CE)"
Combo2.AddItem "M.TECH (CE)"
Else
End If
End Sub
CODE FOR DELETE BUTTON
Private Sub deletebtn_Click()
confirm = MsgBox("Do you want to delete the Student Profile", vbYesNo + vbCritical, "Deletion Confirmation")
If confirm = vbYes Then
rs.Delete adAffectCurrent
MsgBox "Record has been Deleted successfully", vbInformation, "Message"
rs.Update
refreshdata
Else
MsgBox "Profile Not Deleted ..!!", vbInformation, "Message"
End If

End Sub
Sub refreshdata()
rs.Close
rs.Open "Select * from ProfileTBL", con, adOpenStatic, adLockPessimistic
If Not rs.EOF Then
rs.MoveNext
display
Else
MsgBox "No Record Found"
End If
End Sub
CODE FOR SEARCH PROFILE:
Private Sub findbtn_Click()
rs.Close
rs.Open "Select * from ProfileTBL where RollNo='" + Text1.Text + "'", con, adOpenDynamic, adLockPessimistic
If Not rs.EOF Then
display
reload
Else
MsgBox "Record Profile not found ..!!", vbInformation
End If

End Sub
Sub reload()
rs.Close
rs.Open "Select * from ProfileTBL", con, adOpenDynamic, adLockPessimistic
End Sub
Database Connectivity under FORM LOAD
Private Sub Form_Load()
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Database Folder\ProfileDB.mdb;Persist Security Info=False"
rs.Open "Select * from ProfileTBL", con, adOpenDynamic, adLockPessimistic

Combo1.AddItem "Computer Science"
Combo1.AddItem "Electrical Engineering"
Combo1.AddItem "Civil Engineering"
Combo3.AddItem "SEMESTER-I"
Combo3.AddItem "SEMESTER-II"
Combo3.AddItem "SEMESTER-III"
Combo3.AddItem "SEMESTER-IV"
Combo3.AddItem "SEMESTER-V"
Combo3.AddItem "SEMESTER-VI"
Combo3.AddItem "SEMESTER-VII"
Combo3.AddItem "SEMESTER-VIII"
display
End Sub
Sub display()
Text1.Text = rs!Rollno
Text2.Text = rs!Name
DTPicker1.Value = rs!DOB
If rs!Gender = "MALE" Then
Option1.Value = True
Else
Option2.Value = True
End If
Combo1.Text = rs!Dept
Combo2.Text = rs!Course
Combo3.Text = rs!Semester
Text3.Text = rs!Address
Text4.Text = rs!phone
Picture1.Picture = LoadPicture(rs!photo)
End Sub
CODE FOR RECORD NAVIGATION
Private Sub Firstbtn_Click()
rs.MoveFirst
display
End Sub

Private Sub lastbtn_Click()
rs.MoveLast
display
End Sub

Private Sub nextbtn_Click()
rs.MoveNext
If Not rs.EOF Then
display
Else
rs.MoveFirst
display
End If
End Sub

Private Sub Previousbtn_Click()
rs.MovePrevious
If rs.BOF Then
rs.MoveLast
display
Else
display
End If
End Sub
CODE FOR SAVE PROFILE
Private Sub savebtn_Click()
rs.Fields("RollNo").Value = Text1.Text
rs.Fields("Name").Value = Text2.Text
rs.Fields("DOB").Value = DTPicker1.Value
If Option1.Value = True Then
rs.Fields("Gender") = Option1.Caption
Else
rs.Fields("Gender") = Option2.Caption
End If
rs.Fields("Dept").Value = Combo1.Text
rs.Fields("Course").Value = Combo2.Text
rs.Fields("Semester").Value = Combo3.Text
rs.Fields("Address").Value = Text3.Text
rs.Fields("Phone").Value = Text4.Text
rs.Fields("Photo").Value = str
MsgBox "Data is saved successfully ..!!!", vbInformation
rs.Update
End Sub
CODE FOR UPDATE PROFILE
Private Sub updatebtn_Click()
rs.Fields("RollNo").Value = Text1.Text
rs.Fields("Name").Value = Text2.Text
rs.Fields("DOB").Value = DTPicker1.Value
If Option1.Value = True Then
rs.Fields("Gender") = Option1.Caption
Else
rs.Fields("Gender") = Option2.Caption
End If
rs.Fields("Dept").Value = Combo1.Text
rs.Fields("Course").Value = Combo2.Text
rs.Fields("Semester").Value = Combo3.Text
rs.Fields("Address").Value = Text3.Text
rs.Fields("Phone").Value = Text4.Text
MsgBox "Data is updated successfully ..!!!", vbInformation
rs.Update
End Sub
CODE FOR LOADING PICTURE
Private Sub uploadbtn_Click()
CommonDialog1.ShowOpen
CommonDialog1.Filter = "Jpeg|*.jpg"
str = CommonDialog1.FileName
Picture1.Picture = LoadPicture(str)
End Sub

Here is my updated List of Tutorials.
Advance Login System (Splash Screen with Progress Bar,User Registration,Login system,Welcome )   https://youtu.be/s-BU03egpWA
Add Delete Update Search https://youtu.be/K8jq2H3aamk
Data Report in VB6   https://youtu.be/vjQDtKMUCKk
Data Manager in VB6  https://youtu.be/27IrMsEXlBc
Create Tool Bar,Status Bar and Menu Bar   https://youtu.be/3l6bciTAC7Q
Common dialog control- Font and Color Dialog   https://youtu.be/4DBy2ghmu7U
Search Records in Database (By Name or ID)  https://youtu.be/1yNScTVAqZ4
Login Form using Visual Basic 6.0  https://youtu.be/XXKjfta5kkg
Add Delete Update and Clear records  https://youtu.be/tYS7uncH8Ds
Simple Visual Basic Database  Application  https://youtu.be/PldGe0-FnI8
Design Font Dialog Box in VB 6  https://youtu.be/C0CMtoXIFY4
Road Traffic lights Animated system https://youtu.be/74Zvl0bXeAY
ListBox Control( Advanced)  https://youtu.be/Q6NYtmH7z9Q
ListBox Control -Add,Delete and Clear items https://youtu.be/YlmKSyk0l2k
Custom Progress Bar with percentage completed on Splash Screen  https://youtu.be/jGSxrhYZAbE
Frame Control,Check Box and Option Buttons https://youtu.be/9x9dmM0V4CU
Picture Viewer+Browser in Visual Basic  https://youtu.be/POd1Kmpvc0M
Splash Screen with Progress Bar-  https://youtu.be/95hw5z7lq4A
Create Menus,Drop Down Menus ,Nested menus in Menu Bar https://youtu.be/fNtJaQgnuEs

for more about  Visual Basic tutorials,please visit
Youtube Channel:https://www.youtube.com/user/sandydehrian
Computer Gyan Blog:http://selfcomputerlearning.blogspot.in/

Please Share | Support | SUBSCRIBE