SlideShare a Scribd company logo
November 
2014 
All New OOP 2014
Contents 
INTRODUCTION .................................................................................................................................................... 2 
DATABASE .............................................................................................................................................................. 3 
1.1. Create File ............................................................................................................................................. 3 
APPLICATION ........................................................................................................................................................ 5 
2.1. Create File ............................................................................................................................................. 5 
2.2. Connection Class ................................................................................................................................ 7 
2.3. Module ................................................................................................................................................... 8 
2.4. Entity ...................................................................................................................................................... 9 
2.5. Control ................................................................................................................................................ 11 
2.6. Boundary ........................................................................................................................................... 14 
REPORTING ......................................................................................................................................................... 25 
3.1. .rpt File ............................................................................................................................................... 25 
3.2. Reporting Form ............................................................................................................................... 26 
DEPLOYMENT .................................................................................................................................................... 30 
4.1. File System on Target Machine ................................................................................................... 30 
4.2. Deployment ....................................................................................................................................... 32 
# All New OOP Tutorial 2014 # 1
INTRODUCTION 
This article is dedicated to everyone who wants to know more about programming, 
especially to Microsoft Visual Studio in the next generation (VB.Net) and Ms. Access database. in 
this tutorial writter wouldn’t explain any detail about it. This tutorial only tell about basic 
programming. 
As OOP (Object Oriented Programming) is now such a general programming technique 
in dekstop programming, so we will use this technique to complete this article. Then make sure 
your self before continuing and finish this tutorial. 
Another note is, do not continue to the next step with skip a step before. Means you have 
to finish this tutorial step by step. If you have any trouble just tell us. At the end of this article 
you will see how to contact us. We will using Visual Basic.Net 2008 and Ms. Access 2007. 
Best Regards, 
Bambang Wiratmojo 
# All New OOP Tutorial 2014 # 2
DATABASE 
1.1. Create File 
Before we talking too much about creating such as an application sure 
we need to create the storage or we used to call as database. In this tutorial we 
gonna use microsoft access 2007 database. For first step we just need to know 
about stand alone database is ok, then next step we will talking about sharing 
database. 
 Open your microsoft access 2007 database in your pc. 
 Create file and named as PERSON_DB. 
 Create a table inside this database and named as PERSON_TABLE. 
 In Design View create some fields as below : 
Field Name Data Type Field Size 
PersonId Text 3 
FirstName Text 35 
LastName Text 35 
 Close your created database then open again using open exclusive. 
# All New OOP Tutorial 2014 # 3
 Give this database a password using open exclusive access database 
 See at Database Tool Tab  Encrypt with password 
 Set database password as “123” 
 Then save this database at debug file folder in VB project, it wouldn’t be 
guaranteed by me that the application data running well if you dont put 
in here, trust me. 
# All New OOP Tutorial 2014 # 4
APPLICATION 
2.1. Create File 
As we have told at introduction we gonna use Visual Basic.Net 2008, so 
please make sure that you have instaled your own VB2008 correctly, because in 
this article we wouldn’t tell you how to install it. 
 Open your own Visual Studio, create a new project named as “ALL NEW 
OOP” 
 Create a system folders (BOUNDARY, CONTROL, ENTITY, MODUL) to 
classified as below picture. Using right click at Project Name (ALL NEW 
OOP) 
# All New OOP Tutorial 2014 # 5
Then the folders should be as below picture 
 Create Deployment Project, using menu File  Add  New Project. 
Named as “DEPLOY APP” as above picture 
 Right click at DEPLOY APP  Prerequisites 
 At Choose which prerequisites to install, check .NET Framework 2.0 
(x86), Windows Installer 3.1, .NET Framework 3.0 (x86), .NET 
Framework 3.5, Crystal Report Basic for Visual Studio 2008 (x86, x64), 
Visual Studio Tools for the Office system 3.0 Runtime 
 At Specify the install location fore prerequisites, select Download 
prerequisites from the same location as my application 
 Save you setting for the prerequisites to OK. 
 Still at DEPLOY APP, but move to the properties 
o Author : your name 
o Manufacturer : your company name 
o ManufacturerURL : your company URL 
o Product Name : ALL NEW OOP TUTORIAL 2014 
o Support Phone : your phone number 
o Support URL : your email address 
o Title : DEPLOY APP 
# All New OOP Tutorial 2014 # 6
2.2. Connection Class 
 Right click at project file at solution explorer (ALL NEW OOP)  Add  
Class (1st picture) then named as DB_Connection (2nd picture) 
 View code the created then write below source code 
Imports System.Data.OleDb 
Public Class DB_Connection 
'Access Database 2007 
Public DB_CONNECTION As New 
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" _ 
& "Data Source=PERSON_DB.accdb;" 
_ 
& "Jet OLEDB:Database 
Password=123;") 
Public Function OPENCONNECTION() As OleDbConnection 
DB_CONNECTION.Open() 
Return DB_CONNECTION 
End Function 
Public Function CLOSECONNECTION() As OleDbConnection 
DB_CONNECTION.Close() 
Return DB_CONNECTION 
End Function 
End Class 
# All New OOP Tutorial 2014 # 7
2.3. Module 
 Move to Solution Explorer, right click at MODUL folder  Add  Module 
(1st picture), then named as VARIABELNYA (2nd picture) 
 View code the created then write below source code 
Imports System.Data.OleDb 
Module VARIABELNYA 
#Region "DEKLARASI" 
Public CMD As New OleDbCommand 
Public DTA As New OleDbDataAdapter 
Public DTR As OleDbDataReader 
Public DTS As New DataSet 
Public DTT As New DataTable 
#End Region 
#Region "NAMES" 
Public MePERSON_ENT As New PERSON_Entity 
Public MePERSON_CON As New PERSON_Control 
#End Region 
End Module 
# All New OOP Tutorial 2014 # 8
2.4. Entity 
 Move to Solution Explorer, right click at ENTITY folder  Add  Class, 
named as PERSON_Entity 
 View code the created then write below source code 
Public Class PERSON_Entity 
#Region "DECLARATION" 
Private _PersonId As String 
Private _FirstName As String 
Private _LastName As String 
#End Region 
# All New OOP Tutorial 2014 # 9
#Region "PROPERTY" 
Public Overridable Sub DATA_PERSON(ByVal PersonId As 
String, _ 
ByVal FirstName As 
String, _ 
ByVal LastName As 
String) 
_PersonId = PersonId 
_FirstName = FirstName 
_LastName = LastName 
End Sub 
Public Property PersonId() As String 
Get 
Return _PersonId 
End Get 
Set(ByVal value As String) 
_PersonId = value 
End Set 
End Property 
Public Property FirstName() As String 
Get 
Return _FirstName 
End Get 
Set(ByVal value As String) 
_FirstName = value 
End Set 
End Property 
Public Property LastName() As String 
Get 
Return _LastName 
End Get 
Set(ByVal value As String) 
_LastName = value 
End Set 
End Property 
#End Region 
End Class 
# All New OOP Tutorial 2014 # 10
2.5. Control 
 Move to Solution Explorer, right click at CONTROL folder  Add  Class, 
named as PERSON_Control 
 View code the created then write below source code 
Imports System.Data.OleDb 
Public Class PERSON_Control 
Dim MeCONNECTION As New DB_Connection 
#Region "ACTION" 
Public Function SAVE_DATA(ByVal _PERSON As 
PERSON_Entity) As OleDbCommand 
MeCONNECTION.CLOSECONNECTION() 
CMD = New OleDbCommand("Insert Into PERSON_TABLE 
Values (PersonId, FirstName, LastName)", 
MeCONNECTION.OPENCONNECTION) 
CMD.CommandType = CommandType.Text 
Dim _PersonId As New OleDbParameter("@PersonId", 
OleDbType.Char, 3) 
_PersonId.Value = _PERSON.PersonId 
Dim _FirstName As New 
OleDbParameter("@FirstName", OleDbType.Char, 35) 
_FirstName.Value = _PERSON.FirstName 
Dim _LastName As New OleDbParameter("@LastName", 
OleDbType.Char, 35) 
_LastName.Value = _PERSON.LastName 
With CMD.Parameters 
.Add(_PersonId) 
.Add(_FirstName) 
.Add(_LastName) 
End With 
CMD.ExecuteNonQuery() 
CMD = New OleDbCommand("", 
MeCONNECTION.CLOSECONNECTION) 
Return CMD 
# All New OOP Tutorial 2014 # 11
End Function 
Public Function EDIT_DATA(ByVal _PERSON As 
PERSON_Entity) As OleDbCommand 
MeCONNECTION.CLOSECONNECTION() 
CMD = New OleDbCommand("Update PERSON_TABLE Set 
FirstName=@FirstName, LastName=@LastName " & _ 
"Where 
PersonId=@PersonId", MeCONNECTION.OPENCONNECTION) 
CMD.CommandType = CommandType.Text 
Dim _PersonId As New OleDbParameter("@PersonId", 
OleDbType.Char, 3) 
_PersonId.Value = _PERSON.PersonId 
Dim _FirstName As New 
OleDbParameter("@FirstName", OleDbType.Char, 35) 
_FirstName.Value = _PERSON.FirstName 
Dim _LastName As New OleDbParameter("@LastName", 
OleDbType.Char, 35) 
_LastName.Value = _PERSON.LastName 
With CMD.Parameters 
.Add(_FirstName) 
.Add(_LastName) 
.Add(_PersonId) 
End With 
CMD.ExecuteNonQuery() 
CMD = New OleDbCommand("", 
MeCONNECTION.CLOSECONNECTION) 
Return CMD 
End Function 
Public Function DELETE_DATA(ByVal _PERSON As 
PERSON_Entity) As OleDbCommand 
MeCONNECTION.CLOSECONNECTION() 
CMD = New OleDbCommand("Delete From PERSON_TABLE 
Where PersonId=@PersonId", MeCONNECTION.OPENCONNECTION) 
CMD.CommandType = CommandType.Text 
Dim _PersonId As New OleDbParameter("@PersonId", 
OleDbType.Char, 3) 
_PersonId.Value = _PERSON.PersonId 
With CMD.Parameters 
.Add(_PersonId) 
End With 
CMD.ExecuteNonQuery() 
CMD = New OleDbCommand("", 
MeCONNECTION.CLOSECONNECTION) 
Return CMD 
End Function 
#End Region 
# All New OOP Tutorial 2014 # 12
#Region "QUERY" 
Public Overridable Function AUTO_ID() As String 
MeCONNECTION.CLOSECONNECTION() 
DTT = New DataTable 
DTA = New OleDbDataAdapter("SELECT TOP 1 * FROM 
PERSON_TABLE ORDER BY PersonId DESC", 
MeCONNECTION.OPENCONNECTION) 
DTA.Fill(DTT) 
If DTT.Rows.Count = 0 Then 
Return "001" 
Else 
PLUS = Mid(DTT.Rows(0).Item("PersonId"), 3) 
If PLUS = 999 Then 
MsgBox("BARIS DATA MELAMPAUI BATAS 
SISTEM" & vbCrLf & _ 
"SILAHKAN KONTAK PENGEMBANG SISTEM 
ANDA", MsgBoxStyle.Critical) 
Return Nothing 
Else 
PLUS = PLUS + 1 
Return PLUS.ToString.PadLeft(3, "0") 
End If 
End If 
End Function 
Public Function ISI_GRID() As DataView 
Try 
MeCONNECTION.CLOSECONNECTION() 
DTA = New OleDbDataAdapter("SELECT * FROM 
PERSON_TABLE ORDER BY PersonId ASC", 
MeCONNECTION.OPENCONNECTION) 
Try 
DTS = New DataSet 
DTS.Tables("PERSON_TABLE").Clear() 
Catch ex As Exception 
End Try 
DTA.Fill(DTS, "PERSON_TABLE") 
Dim GRID As New 
DataView(DTS.Tables("PERSON_TABLE")) 
Return GRID 
Catch ex As Exception 
Throw New Exception(ex.Message) 
End Try 
End Function 
Public Function CARI_DATA(ByVal CmbCARI As String, 
ByVal TxtCARI As String) As String 
Try 
Dim CARI As String 
MeCONNECTION.CLOSECONNECTION() 
CARI = "SELECT * FROM PERSON_TABLE WHERE " & 
CmbCARI & " LIKE '%" & TxtCARI & "%'" 
DTA = New OleDbDataAdapter(CARI, 
MeCONNECTION.OPENCONNECTION) 
Try 
DTS.Tables("PERSON_TABLE").Clear() 
# All New OOP Tutorial 2014 # 13
Catch ex As Exception 
End Try 
DTA.Fill(DTS, "PERSON_TABLE") 
Dim GRID As New 
DataView(DTS.Tables("PERSON_TABLE")) 
Return CARI 
Catch ex As Exception 
Throw New Exception(ex.Message) 
End Try 
End Function 
#End Region 
End Class 
2.6. Boundary 
 Move to Solution Explorer, add more folder inside BOUNDARY folder, 
Add FORM and REPORT, then at REPORT folder add child folder RFORM 
and RPT as below picture 
 Right click at FORM folder  Add  Windows Form, named as 
MAINFORM and set this as MDI Form application true. 
# All New OOP Tutorial 2014 # 14
 Design the MAINFORM as below 
Detail : 
o Splitter (as separation between menu button and display form) 
o Button (PERSON (BtnPERSON), REPORTING(BtnREPORT)) 
o Lable (OOP TUTORIAL, 2013) 
 View code the created then write below source code 
Public Class MAINFORM 
Private Sub BtnPERSON_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnPERSON.Click 
Dim Frm As New PERSON_LIST 
With Frm 
.MdiParent = Me 
.WindowState = FormWindowState.Maximized 
.Show() 
End With 
End Sub 
Private Sub BtnREPORT_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnREPORT.Click 
Dim Frm As New FPRINT 
With Frm 
.MdiParent = Me 
.WindowState = FormWindowState.Maximized 
.Show() 
End With 
End Sub 
End Class 
# All New OOP Tutorial 2014 # 15
 Right click at FORM folder  Add  Windows Form, named as 
PERSON_LIST 
 Design the PERSON_LIST as below 
Detail : 
o Datagridview (DgvPERSON) 
o Button (&NEW ENTRY (BtnNEWENTRY), &CLOSE (BtnCLOSE), 
&FIND (BtnFIND)) 
o Textbox (KEYWORD (TxtFIND)) 
o ComboBox (SELECT(CmbFIND)) 
o Lable (PERSON, SELECT, KEYWORD) 
o Datagridview setting, deselect all item 
# All New OOP Tutorial 2014 # 16
o Click Edit Columns 
o Click Add  Name=DgvBtnEDIT, 
Type=DataGridViewButtonColumn, Header Text = EDIT 
o Double click, DefaultCellStyle 
o NullValue=EDIT 
o Click Add  Name=DgvBtnDELETE, 
Type=DataGridViewButtonColumn, Header Text = DELETE 
o Double click, DefaultCellStyle 
o NullValue=DELETE 
o Click Add  Name=ID, Type=DataGridViewTextboxColumn, 
o Header Text = ID 
o Name = PersonId 
o DataPropertyName = PersonId 
o Click Add  Name=FirstName, 
Type=DataGridViewTextboxColumn, 
o Header Text = FIRST NAME 
o Name = FirstName 
o DataPropertyName = FirstName 
o Click Add  Name=LastName, 
Type=DataGridViewTextboxColumn, 
o Header Text = LAST NAME 
o Name = LastName 
o DataPropertyName = LastName 
# All New OOP Tutorial 2014 # 17
 View code the created then write below source code 
Public Class PERSON_LIST 
#Region "EVENT" 
Private Sub PERSON_LIST_Load(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
MyBase.Activated 
Try 
DgvPERSON.DataSource = MePERSON_CON.ISI_GRID 
Call CAPITAL() 
Call FORMAT() 
Catch ex As Exception 
MsgBox(ex.Message) 
End Try 
End Sub 
Private Sub CmbFIND_SelectedIndexChanged(ByVal sender 
As System.Object, ByVal e As System.EventArgs) Handles 
CmbFIND.SelectedIndexChanged 
TxtFIND.Text = "" 
TxtFIND.Focus() 
DgvPERSON.DataSource = MePERSON_CON.ISI_GRID 
End Sub 
Private Sub BtnFIND_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnFIND.Click 
MePERSON_CON.CARI_DATA(CmbFIND.SelectedValue, 
TxtFIND.Text) 
End Sub 
Private Sub TxtFIND_KeyPress(ByVal sender As Object, 
ByVal e As System.Windows.Forms.KeyPressEventArgs) 
Handles TxtFIND.KeyPress 
If e.KeyChar = Chr(13) Then 
BtnFIND.Focus() 
End If 
End Sub 
Private Sub BtnCLOSE_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnCLOSE.Click 
Me.Close() 
End Sub 
Private Sub BtnNEWENTRY_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnNEWENTRY.Click 
Dim Frm As New PERSON 
With Frm 
.MdiParent = MAINFORM 
.WindowState = FormWindowState.Maximized 
.Show() 
End With 
End Sub 
Private Sub DgvPERSON_CellContentClick(ByVal sender 
As System.Object, ByVal e As 
# All New OOP Tutorial 2014 # 18
System.Windows.Forms.DataGridViewCellEventArgs) Handles 
DgvPERSON.CellContentClick 
Dim Frm As New PERSON(INFO_DATA()) 
Select Case e.ColumnIndex 
Case 0 
DgvBtnEDIT.Text = "EDIT" 
With Frm 
.MdiParent = MAINFORM 
.WindowState = 
FormWindowState.Maximized 
.BtnSAVE.Text = "&EDIT" 
.BtnCLOSE.Text = "&CANCEL" 
.Show() 
End With 
Case 1 
DgvBtnDELETE.Text = "DELETE" 
With Frm 
.MdiParent = MAINFORM 
.WindowState = 
FormWindowState.Maximized 
.BtnSAVE.Text = "&DELETE" 
.BtnCLOSE.Text = "&CANCEL" 
.Show() 
End With 
End Select 
End Sub 
Private Function INFO_DATA() As PERSON_Entity 
With MePERSON_ENT 
.PersonId = DgvPERSON.Item(2, 
DgvPERSON.CurrentRow.Index).Value 
.FirstName = DgvPERSON.Item(3, 
DgvPERSON.CurrentRow.Index).Value 
.LastName = DgvPERSON.Item(4, 
DgvPERSON.CurrentRow.Index).Value 
End With 
Return MePERSON_ENT 
End Function 
#End Region 
#Region "OTOMATICALY" 
Private Sub FORMAT() 
With DgvPERSON 
.Columns(2).Width = 60 
.Columns(3).Width = 200 
.Columns(4).Width = 200 
End With 
With CmbFIND 
DTT = New DataTable 
DTT.Columns.Add("Id") 
DTT.Columns.Add("Name") 
DTT.Rows.Add("PERSON_TABLE.PersonId", "ID") 
DTT.Rows.Add("PERSON_TABLE.FirstName", "FIRST 
NAME") 
# All New OOP Tutorial 2014 # 19
DTT.Rows.Add("PERSON_TABLE.LastName", "LAST 
NAME") 
.DataSource = DTT 
.DisplayMember = "Name" 
.ValueMember = "Id" 
End With 
End Sub 
Private Sub CAPITAL() 
TxtFIND.CharacterCasing = CharacterCasing.Upper 
End Sub 
#End Region 
End Class 
 Right click at FORM folder  Add  Windows Form, named as PERSON 
 Design the PERSON as below 
Detail : 
o Lable (PERSON, FIRST NAME, LAST NAME, ID(LblPERSONID)) 
o Button (&INPUT (BtnSAVE), &CLOSE (BtnCLOSE)) 
o Textbox (FIRST NAME (TxtFIRSTNAME), LAST 
NAME(TxtLASTNAME)) 
 View code the created then write below source code 
Public Class PERSON 
#Region "TEXT" 
Private Sub TEXTDEACTIVE() 
TxtFIRSTNAME.Enabled = False 
TxtLASTNAME.Enabled = False 
End Sub 
Private Sub TEXTACTIVE() 
TxtFIRSTNAME.Enabled = True 
TxtLASTNAME.Enabled = True 
End Sub 
# All New OOP Tutorial 2014 # 20
Private Sub TEXTEMPTY() 
LblPERSONID.Text = "" 
TxtFIRSTNAME.Text = "" 
TxtLASTNAME.Text = "" 
End Sub 
Private Sub CAPITAL() 
TxtFIRSTNAME.CharacterCasing = 
CharacterCasing.Upper 
TxtLASTNAME.CharacterCasing = 
CharacterCasing.Upper 
End Sub 
Private Sub TEXTLIMIT() 
TxtFIRSTNAME.MaxLength = 35 
TxtLASTNAME.MaxLength = 35 
End Sub 
#End Region 
#Region "BUTTON" 
Private Sub BUTTONREADY() 
Call TEXTACTIVE() 
TxtFIRSTNAME.Focus() 
BtnSAVE.Text = "&SAVE" 
BtnCLOSE.Text = "&CANCEL" 
End Sub 
Private Sub BUTTONBEGIN() 
BtnSAVE.Text = "&INPUT" 
BtnCLOSE.Text = "&CLOSE" 
End Sub 
Private Sub BUTTONEDIT() 
Call TEXTACTIVE() 
TxtFIRSTNAME.Focus() 
BtnSAVE.Text = "&OK" 
BtnCLOSE.Text = "&CANCEL" 
End Sub 
Private Sub BUTTONDELETE() 
TxtFIRSTNAME.Focus() 
BtnCLOSE.Text = "&CANCEL" 
End Sub 
#End Region 
#Region "ACTION" 
Private Sub SAVE_DATA() 
If TxtFIRSTNAME.Text = "" Or TxtLASTNAME.Text = 
"" Then 
MsgBox("THERE ARE NO DATA TO BE SAVED !!!", 
MsgBoxStyle.Critical, Me.Text) 
Call TEXTDEACTIVE() 
Call TEXTEMPTY() 
Call BUTTONBEGIN() 
# All New OOP Tutorial 2014 # 21
Else 
MePERSON_ENT.PersonId = LblPERSONID.Text 
MePERSON_ENT.FirstName = TxtFIRSTNAME.Text 
MePERSON_ENT.LastName = TxtLASTNAME.Text 
MePERSON_CON.SAVE_DATA(MePERSON_ENT) 
MsgBox("DATA HAS BEEN SAVED!!!", 
MsgBoxStyle.Information, Me.Text) 
Call TEXTDEACTIVE() 
Call TEXTEMPTY() 
Call BUTTONBEGIN() 
End If 
End Sub 
Private Sub EDIT_DATA() 
If TxtFIRSTNAME.Text = "" Or TxtLASTNAME.Text = 
"" Then 
MsgBox("THERE ARE NO DATA TO BE EDITED !!!", 
MsgBoxStyle.Critical, Me.Text) 
Call TEXTDEACTIVE() 
Call TEXTEMPTY() 
Call BUTTONBEGIN() 
Else 
MePERSON_ENT.PersonId = LblPERSONID.Text 
MePERSON_ENT.FirstName = TxtFIRSTNAME.Text 
MePERSON_ENT.LastName = TxtLASTNAME.Text 
MePERSON_CON.EDIT_DATA(MePERSON_ENT) 
MsgBox("DATA HAS BEEN EDITED!!!", 
MsgBoxStyle.Information, Me.Text) 
Call TEXTDEACTIVE() 
Call TEXTEMPTY() 
Call BUTTONBEGIN() 
End If 
End Sub 
Private Sub DELETE_DATA() 
If TxtFIRSTNAME.Text = "" Or TxtLASTNAME.Text = 
"" Then 
MsgBox("THERE ARE NO DATA TO BE DELETED !!!", 
MsgBoxStyle.Critical, Me.Text) 
Call TEXTDEACTIVE() 
Call TEXTEMPTY() 
Call BUTTONBEGIN() 
Else 
MePERSON_ENT.PersonId = LblPERSONID.Text 
MePERSON_CON.DELETE_DATA(MePERSON_ENT) 
MsgBox("DATA HAS BEEN DELETED!!!", 
MsgBoxStyle.Information, Me.Text) 
Call TEXTDEACTIVE() 
Call TEXTEMPTY() 
Call BUTTONBEGIN() 
End If 
End Sub 
#End Region 
# All New OOP Tutorial 2014 # 22
#Region "EVENT" 
Private Sub CHOOSEACTION() 
Select Case BtnSAVE.Text 
Case "&INPUT" 
TEXTDEACTIVE() 
TEXTEMPTY() 
Case "&EDIT" 
TEXTDEACTIVE() 
Case "&DELETE" 
TEXTDEACTIVE() 
End Select 
End Sub 
Public Sub New() 
InitializeComponent() 
End Sub 
Public Sub New(ByVal MeOBJECT As PERSON_Entity) 
InitializeComponent() 
LblPERSONID.Text = MeOBJECT.PersonId 
TxtFIRSTNAME.Text = MeOBJECT.FirstName 
TxtLASTNAME.Text = MeOBJECT.LastName 
End Sub 
Private Sub BtnSAVE_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnSAVE.Click 
Select Case BtnSAVE.Text 
Case "&INPUT" 
BUTTONREADY() 
LblPERSONID.Text = MePERSON_CON.AUTO_ID 
Case "&SAVE" 
SAVE_DATA() 
Case "&DELETE" 
DELETE_DATA() 
Case "&EDIT" 
BUTTONEDIT() 
Case "&OK" 
EDIT_DATA() 
End Select 
End Sub 
Private Sub PERSON_Load(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
MyBase.Load 
Call CHOOSEACTION() 
Call CAPITAL() 
Call TEXTLIMIT() 
End Sub 
# All New OOP Tutorial 2014 # 23
Private Sub BtnCLOSE_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnCLOSE.Click 
Select Case BtnCLOSE.Text 
Case "&CANCEL" 
Call BUTTONBEGIN() 
Call TEXTDEACTIVE() 
Call TEXTEMPTY() 
Case "&CLOSE" 
Me.Close() 
End Select 
End Sub 
Private Sub TxtFIRSTNAME_KeyPress(ByVal sender As 
Object, ByVal e As 
System.Windows.Forms.KeyPressEventArgs) Handles 
TxtFIRSTNAME.KeyPress 
If e.KeyChar = Chr(13) Then 
TxtLASTNAME.Focus() 
End If 
End Sub 
Private Sub TxtLASTNAME_KeyPress(ByVal sender As 
Object, ByVal e As 
System.Windows.Forms.KeyPressEventArgs) Handles 
TxtLASTNAME.KeyPress 
If e.KeyChar = Chr(13) Then 
BtnSAVE.Focus() 
End If 
End Sub 
#End Region 
End Class 
# All New OOP Tutorial 2014 # 24
REPORTING 
3.1. .rpt File 
 Right click at RPT folder  Add  New Item  Reporting  Crystal 
Report, named as RPT_PERSON 
 Set Database Fields, Report Design as below picture 
 View Preview Data should be as follow, offcourse after inputed data 
# All New OOP Tutorial 2014 # 25
3.2. Reporting Form 
 Right click at RFORM folder  Add  Windows Form, named as 
FPERSON 
 Drag CrystalReportViewer into the form, names as CrysPERSON 
 View code the created then write below source code 
Imports CrystalDecisions.Shared 
Imports CrystalDecisions.CrystalReports.Engine 
Public Class FPERSON 
Dim strSELECT As String 
Dim MeCONNECTION As New DB_Connection 
Dim CrRpt As New ReportDocument 
Public Sub New(ByVal _strSELECT As String) 
InitializeComponent() 
strSELECT = _strSELECT 
End Sub 
Private Sub PRINT() 
Try 
CrRpt = New ALL_NEW_OOP.RPT_PERSON 
CrRpt.PrintOptions.PaperSource = 
PaperSource.Manual 
CrRpt.DataDefinition.RecordSelectionFormula = 
strSELECT 
Dim DTA As New OleDb.OleDbDataAdapter 
Dim DTS As New DataSet 
DTA = New OleDb.OleDbDataAdapter(strSELECT, 
MeCONNECTION.CLOSECONNECTION) 
DTA.Fill(DTS, "PERSON_TABLE") 
CrRpt.Load(Application.StartupPath & 
"/RPT_PERSON.rpt") 
CrRpt.SetDataSource(DTS) 
CrysPERSON.DisplayGroupTree = False 
CrysPERSON.ShowGroupTreeButton = False 
CrysPERSON.ShowExportButton = True 
CrysPERSON.ReportSource = CrRpt 
CrysPERSON.Refresh() 
CrysPERSON.RefreshReport() 
DTS.Clear() 
Catch ex As Exception 
MsgBox(ex.Message.ToString, 
MsgBoxStyle.OkOnly, "ERROR") 
End Try 
End Sub 
# All New OOP Tutorial 2014 # 26
Private Sub FPERSON_Load(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
MyBase.Load 
Call PRINT() 
CrysPERSON.Zoom(85) 
End Sub 
End Class 
 Right click at RFORM folder  Add  Windows Form, named as FPRINT 
 Design the FPRINT as below 
Detail : 
o Lable (PREVIEW DATA, SELECT REPORT, SELECT QUERY, 
KEYWORD) 
o Button (&PRINT (BtnPRINTALLDATA), &PRINT (BtnQUERY)) 
o Combobox (SELECT REPORT (CmbALLDATA, 
CmbSELECTREPORT), SELECT QUERY (CmbQUERY)) 
o Textbox (KEYWORD (TxtKEYWORD)) 
# All New OOP Tutorial 2014 # 27
 View code the created then write below source code 
Public Class FPRINT 
#Region "EVENT" 
Private Sub FPRINT_Load(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
MyBase.Load 
Call COMBO_PRINT() 
TxtKEYWORD.CharacterCasing = 
CharacterCasing.Upper 
End Sub 
Private Sub BtnPRINTALLDATA_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnPRINTALLDATA.Click 
Dim RptQuery As String = "SELECT * FROM 
PERSON_TABLE ORDER BY PersonId ASC" 
Select Case CmbALLDATA.Text 
Case "PERSON REPORT" 
Dim Frm As New FPERSON(RptQuery) 
With Frm 
.MdiParent = MAINFORM 
.WindowState = 
FormWindowState.Maximized 
.Show() 
End With 
End Select 
End Sub 
Private Sub BtnQUERY_Click(ByVal sender As 
System.Object, ByVal e As System.EventArgs) Handles 
BtnQUERY.Click 
Dim RptQuery As String = "Select * From 
PERSON_TABLE Where " & CmbQUERY.SelectedValue & " Like 
'%" & TxtKEYWORD.Text & "%'" 
Select Case CmbSELECTREPORT.Text 
Case "PERSON REPORT" 
Dim Frm As New FPERSON(RptQuery) 
With Frm 
.MdiParent = MAINFORM 
.WindowState = 
FormWindowState.Maximized 
.Show() 
End With 
End Select 
End Sub 
Private Sub CmbQUERY_SelectedValueChanged(ByVal 
sender As Object, ByVal e As System.EventArgs) Handles 
CmbQUERY.SelectedValueChanged 
TxtKEYWORD.Text = "" 
TxtKEYWORD.Focus() 
End Sub 
Private Sub 
CmbSELECTREPORT_SelectedValueChanged(ByVal sender As 
Object, ByVal e As System.EventArgs) Handles 
CmbSELECTREPORT.SelectedValueChanged 
DTT = New DataTable 
# All New OOP Tutorial 2014 # 28
DTT.Columns.Add("ID") 
DTT.Columns.Add("Name") 
DTT.Rows.Add("PersonId", "ID NUM") 
DTT.Rows.Add("FirstName", "FIRST NAME") 
DTT.Rows.Add("LastName", "LAST NAME") 
CmbQUERY.DataSource = DTT 
CmbQUERY.DisplayMember = "Name" 
CmbQUERY.ValueMember = "ID" 
End Sub 
Private Sub TxtKEYWORD_KeyPress(ByVal sender As 
Object, ByVal e As 
System.Windows.Forms.KeyPressEventArgs) Handles 
TxtKEYWORD.KeyPress 
If e.KeyChar = Chr(13) Then 
BtnQUERY.Focus() 
End If 
End Sub 
#End Region 
#Region "OTOMATICALY" 
Private Sub COMBO_PRINT() 
Dim A As String = "PERSON REPORT" 
With CmbALLDATA 
.Items.Clear() 
.Items.Add(A) 
End With 
With CmbSELECTREPORT 
.Items.Clear() 
.Items.Add(A) 
End With 
With CmbQUERY 
.Items.Clear() 
.Items.Add("ID NUM") 
.Items.Add("FIRST NAME") 
.Items.Add("LAST NAME") 
End With 
End Sub 
#End Region 
End Class 
# All New OOP Tutorial 2014 # 29
DEPLOYMENT 
4.1. File System on Target Machine 
 Right click at DEPLOY APP project  View  File System 
 Select Application Folder as below picture. 
 At the right column, right click  Add  Assembly 
# All New OOP Tutorial 2014 # 30
 Pointing to Tab Browse  Select ALL NEW OOP .exe 
 At the right column, right click  Add  File 
 Pointing to Tab Browse  Select PERSON_DB 
 At the right column, right click  Add  File 
 Pointing to Tab Browse  Select Minimize_Box_Blue # this is such as an 
additional file (shortcut), so may able to add this things or not this step is 
up to you... 
 At the right column, right click at ALL NEW OOP.exe  Create Shortcut 
to ALL NEW OOP.exe 
 Set the Shortcut properties as 
o Name : ALL NEW OOP 
o Icon : select our added icon before 
# All New OOP Tutorial 2014 # 31
o Cut this shortcut, then paste in User’s Dekstop in left column 
under File System on Target Machine 
 Creata a new folder in User’s Programs Menu at left column under File 
System on Target Machine, and named as ALL NEW OOP 
 At the right column, right click at ALL NEW OOP.exe  Create Shortcut 
to ALL NEW OOP.exe 
 Set the Shortcut properties as 
o Name : ALL NEW OOP 
o Icon : select our added icon before 
 Cut this shortcut, then paste in User’s Programs Menu in left column 
under File System on Target Machine 
4.2. Deployment 
 Right click at DEPLOY APP  Build 
 Wait for a second while until finish visual studio is Building our 
application become a setup application. Message information when 
building application is at below left side of visual studio. Wait until you 
can read at that place the word “Succeeded” 
# All New OOP Tutorial 2014 # 32
Polymorphic372 
Is a System Developer at Bridgestone Tire Indonesia. Graduated from 
STMIK Akademi Bina Insani Bekasi 2012 majoring Information and 
Technology. Wish to always dedicated him self to IT in Indonesia and 
the world. 
Contact : 
bambang.wiratmojo@bridgestone.co.id 
Blog : 
Polymorphic372.blogspot.com 
ALL NEW OOP TUTORIAL 2014 
SUPPORTED BY CLAYMORECODE 2014 
# All New OOP Tutorial 2014 # 33

More Related Content

What's hot

Capstone Project Last Demonstration
Capstone Project Last DemonstrationCapstone Project Last Demonstration
Capstone Project Last Demonstration
Matthew Chang
 
Lab: Mobile App Development with XPages and Extension Library
Lab:  Mobile App Development with XPages and Extension LibraryLab:  Mobile App Development with XPages and Extension Library
Lab: Mobile App Development with XPages and Extension Library
WorkFlowStudios
 
Flex Building User Interface Components
Flex Building User Interface ComponentsFlex Building User Interface Components
Flex Building User Interface Components
Ahmad Hamid
 
User guide
 User guide User guide
User guide
ricemjr124
 
Installation Process Of New Gen Lib Oss On Windows Xp For Library Automation ...
Installation Process Of New Gen Lib Oss On Windows Xp For Library Automation ...Installation Process Of New Gen Lib Oss On Windows Xp For Library Automation ...
Installation Process Of New Gen Lib Oss On Windows Xp For Library Automation ...
Goutam Biswas
 
Practical Installation Process Of New Gen Lib Oss On Windows Xp For Library A...
Practical Installation Process Of New Gen Lib Oss On Windows Xp For Library A...Practical Installation Process Of New Gen Lib Oss On Windows Xp For Library A...
Practical Installation Process Of New Gen Lib Oss On Windows Xp For Library A...
Goutam Biswas
 
Newgenlib
NewgenlibNewgenlib
Newgenlib
Shiba Bhue
 
Spring IOC advantages and developing spring application sample
Spring IOC advantages and developing spring application sample Spring IOC advantages and developing spring application sample
Spring IOC advantages and developing spring application sample
Sunil kumar Mohanty
 
Chapter 2. Make Business Process and Getting the Data with YAWL
Chapter 2. Make Business Process and Getting the Data with YAWLChapter 2. Make Business Process and Getting the Data with YAWL
Chapter 2. Make Business Process and Getting the Data with YAWL
Dewi Rahmawati
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
Sergio Nakamura
 
Lab1-android
Lab1-androidLab1-android
Lab1-android
Lilia Sfaxi
 
AcroButtonsTutorial
AcroButtonsTutorialAcroButtonsTutorial
AcroButtonsTutorial
tutorialsruby
 
Murach : How to work with session state and cookies
Murach : How to work with session state and cookiesMurach : How to work with session state and cookies
Murach : How to work with session state and cookies
MahmoudOHassouna
 
Part 1 implementing a simple_web_service
Part 1 implementing a simple_web_servicePart 1 implementing a simple_web_service
Part 1 implementing a simple_web_service
krishmdkk
 
Sencha touch
Sencha touchSencha touch
Sencha touch
Akshay Prabhu
 
0065 using sequelink
0065 using sequelink0065 using sequelink
0065 using sequelink
Janardhan Reddy
 
Blind sql injection
Blind sql injectionBlind sql injection
Blind sql injection
Kagi Adrian Zinelli
 

What's hot (17)

Capstone Project Last Demonstration
Capstone Project Last DemonstrationCapstone Project Last Demonstration
Capstone Project Last Demonstration
 
Lab: Mobile App Development with XPages and Extension Library
Lab:  Mobile App Development with XPages and Extension LibraryLab:  Mobile App Development with XPages and Extension Library
Lab: Mobile App Development with XPages and Extension Library
 
Flex Building User Interface Components
Flex Building User Interface ComponentsFlex Building User Interface Components
Flex Building User Interface Components
 
User guide
 User guide User guide
User guide
 
Installation Process Of New Gen Lib Oss On Windows Xp For Library Automation ...
Installation Process Of New Gen Lib Oss On Windows Xp For Library Automation ...Installation Process Of New Gen Lib Oss On Windows Xp For Library Automation ...
Installation Process Of New Gen Lib Oss On Windows Xp For Library Automation ...
 
Practical Installation Process Of New Gen Lib Oss On Windows Xp For Library A...
Practical Installation Process Of New Gen Lib Oss On Windows Xp For Library A...Practical Installation Process Of New Gen Lib Oss On Windows Xp For Library A...
Practical Installation Process Of New Gen Lib Oss On Windows Xp For Library A...
 
Newgenlib
NewgenlibNewgenlib
Newgenlib
 
Spring IOC advantages and developing spring application sample
Spring IOC advantages and developing spring application sample Spring IOC advantages and developing spring application sample
Spring IOC advantages and developing spring application sample
 
Chapter 2. Make Business Process and Getting the Data with YAWL
Chapter 2. Make Business Process and Getting the Data with YAWLChapter 2. Make Business Process and Getting the Data with YAWL
Chapter 2. Make Business Process and Getting the Data with YAWL
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
 
Lab1-android
Lab1-androidLab1-android
Lab1-android
 
AcroButtonsTutorial
AcroButtonsTutorialAcroButtonsTutorial
AcroButtonsTutorial
 
Murach : How to work with session state and cookies
Murach : How to work with session state and cookiesMurach : How to work with session state and cookies
Murach : How to work with session state and cookies
 
Part 1 implementing a simple_web_service
Part 1 implementing a simple_web_servicePart 1 implementing a simple_web_service
Part 1 implementing a simple_web_service
 
Sencha touch
Sencha touchSencha touch
Sencha touch
 
0065 using sequelink
0065 using sequelink0065 using sequelink
0065 using sequelink
 
Blind sql injection
Blind sql injectionBlind sql injection
Blind sql injection
 

Viewers also liked

Names of contractors and vendors
Names of contractors and vendorsNames of contractors and vendors
Names of contractors and vendors
Sharjeel Aslam Faiz
 
Tugas ilmu sosial dasar pembahasan 3
Tugas ilmu sosial dasar pembahasan 3Tugas ilmu sosial dasar pembahasan 3
Tugas ilmu sosial dasar pembahasan 3
Arif Kadarmanto P
 
Fixing business models by design - By Valentijn Destoop
Fixing business models by design - By Valentijn DestoopFixing business models by design - By Valentijn Destoop
Fixing business models by design - By Valentijn Destoop
Product Design Meetup
 
DIFFERENCES IN LEARNERS
DIFFERENCES IN LEARNERSDIFFERENCES IN LEARNERS
DIFFERENCES IN LEARNERS
belenita78
 
Trinidad
TrinidadTrinidad
Trinidad
Angelo_Trinidad
 
Getting up close and personal with mobile research
Getting up close and personal with mobile researchGetting up close and personal with mobile research
Getting up close and personal with mobile research
VietnamBusinessTV
 
Diversity in the Media: How the Media Sees Me
Diversity in the Media: How the Media Sees MeDiversity in the Media: How the Media Sees Me
Diversity in the Media: How the Media Sees Me
Andrea Ruiz
 
Mata tak bisa berbohong
Mata tak bisa berbohongMata tak bisa berbohong
Mata tak bisa berbohong
Ichal Amir
 
ידיעון כרמיה 1-2015
ידיעון כרמיה 1-2015ידיעון כרמיה 1-2015
ידיעון כרמיה 1-2015
perachadi
 
Persistent and Flexible: Student staff hiring, training, and management
Persistent and Flexible: Student staff hiring, training, and managementPersistent and Flexible: Student staff hiring, training, and management
Persistent and Flexible: Student staff hiring, training, and management
Andrew Lyons
 
Managing Me - Finding Harmony in Skills and Self
Managing Me - Finding Harmony in Skills and SelfManaging Me - Finding Harmony in Skills and Self
Managing Me - Finding Harmony in Skills and Self
Khe Hy
 
Voluntary efforts post nepal earthquake
Voluntary efforts post nepal earthquakeVoluntary efforts post nepal earthquake
Voluntary efforts post nepal earthquake
Akash Shrestha
 
Publishing in the Digital Age
Publishing in the Digital AgePublishing in the Digital Age
Publishing in the Digital Age
VietnamBusinessTV
 

Viewers also liked (13)

Names of contractors and vendors
Names of contractors and vendorsNames of contractors and vendors
Names of contractors and vendors
 
Tugas ilmu sosial dasar pembahasan 3
Tugas ilmu sosial dasar pembahasan 3Tugas ilmu sosial dasar pembahasan 3
Tugas ilmu sosial dasar pembahasan 3
 
Fixing business models by design - By Valentijn Destoop
Fixing business models by design - By Valentijn DestoopFixing business models by design - By Valentijn Destoop
Fixing business models by design - By Valentijn Destoop
 
DIFFERENCES IN LEARNERS
DIFFERENCES IN LEARNERSDIFFERENCES IN LEARNERS
DIFFERENCES IN LEARNERS
 
Trinidad
TrinidadTrinidad
Trinidad
 
Getting up close and personal with mobile research
Getting up close and personal with mobile researchGetting up close and personal with mobile research
Getting up close and personal with mobile research
 
Diversity in the Media: How the Media Sees Me
Diversity in the Media: How the Media Sees MeDiversity in the Media: How the Media Sees Me
Diversity in the Media: How the Media Sees Me
 
Mata tak bisa berbohong
Mata tak bisa berbohongMata tak bisa berbohong
Mata tak bisa berbohong
 
ידיעון כרמיה 1-2015
ידיעון כרמיה 1-2015ידיעון כרמיה 1-2015
ידיעון כרמיה 1-2015
 
Persistent and Flexible: Student staff hiring, training, and management
Persistent and Flexible: Student staff hiring, training, and managementPersistent and Flexible: Student staff hiring, training, and management
Persistent and Flexible: Student staff hiring, training, and management
 
Managing Me - Finding Harmony in Skills and Self
Managing Me - Finding Harmony in Skills and SelfManaging Me - Finding Harmony in Skills and Self
Managing Me - Finding Harmony in Skills and Self
 
Voluntary efforts post nepal earthquake
Voluntary efforts post nepal earthquakeVoluntary efforts post nepal earthquake
Voluntary efforts post nepal earthquake
 
Publishing in the Digital Age
Publishing in the Digital AgePublishing in the Digital Age
Publishing in the Digital Age
 

Similar to ALL NEW OOP 2014

154090896 installation-of-oracle-database-12c
154090896 installation-of-oracle-database-12c154090896 installation-of-oracle-database-12c
154090896 installation-of-oracle-database-12c
Venkatesh Ramiya Krishnamoorthy
 
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesUsing prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile services
David Voyles
 
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Amit Singh
 
(CRUD) How To Connect To Microsoft Access Database Insert Update Delete Clear...
(CRUD) How To Connect To Microsoft Access Database Insert Update Delete Clear...(CRUD) How To Connect To Microsoft Access Database Insert Update Delete Clear...
(CRUD) How To Connect To Microsoft Access Database Insert Update Delete Clear...
mauricemuteti2015
 
Linq to sql
Linq to sqlLinq to sql
Linq to sql
Muhammad Younis
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFramework
Akhil Mittal
 
Oracle to vb 6.0 connectivity
Oracle to vb 6.0 connectivityOracle to vb 6.0 connectivity
Oracle to vb 6.0 connectivity
rohit vishwakarma
 
Dbi h315
Dbi h315Dbi h315
Android | Busy Java Developers Guide to Android: Persistence | Ted Neward
Android | Busy Java Developers Guide to Android: Persistence | Ted NewardAndroid | Busy Java Developers Guide to Android: Persistence | Ted Neward
Android | Busy Java Developers Guide to Android: Persistence | Ted Neward
JAX London
 
Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3
Katy Slemon
 
Adapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureAdapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedure
prathap kumar
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
sreedath c g
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
Alfa Gama Omega
 
Multiple files single target single interface
Multiple files single target single interfaceMultiple files single target single interface
Multiple files single target single interface
Dharmaraj Borse
 
DotNetNuke
DotNetNukeDotNetNuke
DotNetNuke
Ambati Sreedhar
 
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2015 Ma...
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2015 Ma...Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2015 Ma...
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2015 Ma...
Mumbai B.Sc.IT Study
 
Install NewGenLib on Windows XP
Install NewGenLib on Windows XPInstall NewGenLib on Windows XP
Install NewGenLib on Windows XP
Rupesh Kumar
 
Creating master and work repository
Creating master and work repositoryCreating master and work repository
Creating master and work repository
Ravi Kumar Lanke
 
Installing ingres enterprise access in a system which already has an ingres i...
Installing ingres enterprise access in a system which already has an ingres i...Installing ingres enterprise access in a system which already has an ingres i...
Installing ingres enterprise access in a system which already has an ingres i...
malu42
 
Introduction to Spring Boot.pdf
Introduction to Spring Boot.pdfIntroduction to Spring Boot.pdf
Introduction to Spring Boot.pdf
ShaiAlmog1
 

Similar to ALL NEW OOP 2014 (20)

154090896 installation-of-oracle-database-12c
154090896 installation-of-oracle-database-12c154090896 installation-of-oracle-database-12c
154090896 installation-of-oracle-database-12c
 
Using prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile servicesUsing prime[31] to connect your unity game to azure mobile services
Using prime[31] to connect your unity game to azure mobile services
 
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
Oracle EBS 12.1.3 : Integrate OA Framework BC4J components within java concur...
 
(CRUD) How To Connect To Microsoft Access Database Insert Update Delete Clear...
(CRUD) How To Connect To Microsoft Access Database Insert Update Delete Clear...(CRUD) How To Connect To Microsoft Access Database Insert Update Delete Clear...
(CRUD) How To Connect To Microsoft Access Database Insert Update Delete Clear...
 
Linq to sql
Linq to sqlLinq to sql
Linq to sql
 
Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFramework
 
Oracle to vb 6.0 connectivity
Oracle to vb 6.0 connectivityOracle to vb 6.0 connectivity
Oracle to vb 6.0 connectivity
 
Dbi h315
Dbi h315Dbi h315
Dbi h315
 
Android | Busy Java Developers Guide to Android: Persistence | Ted Neward
Android | Busy Java Developers Guide to Android: Persistence | Ted NewardAndroid | Busy Java Developers Guide to Android: Persistence | Ted Neward
Android | Busy Java Developers Guide to Android: Persistence | Ted Neward
 
Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3Crud operations using aws dynamo db with flask ap is and boto3
Crud operations using aws dynamo db with flask ap is and boto3
 
Adapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedureAdapters db-104-informixstoredprocedure
Adapters db-104-informixstoredprocedure
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
Aspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_csAspnet mvc tutorial_01_cs
Aspnet mvc tutorial_01_cs
 
Multiple files single target single interface
Multiple files single target single interfaceMultiple files single target single interface
Multiple files single target single interface
 
DotNetNuke
DotNetNukeDotNetNuke
DotNetNuke
 
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2015 Ma...
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2015 Ma...Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2015 Ma...
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2015 Ma...
 
Install NewGenLib on Windows XP
Install NewGenLib on Windows XPInstall NewGenLib on Windows XP
Install NewGenLib on Windows XP
 
Creating master and work repository
Creating master and work repositoryCreating master and work repository
Creating master and work repository
 
Installing ingres enterprise access in a system which already has an ingres i...
Installing ingres enterprise access in a system which already has an ingres i...Installing ingres enterprise access in a system which already has an ingres i...
Installing ingres enterprise access in a system which already has an ingres i...
 
Introduction to Spring Boot.pdf
Introduction to Spring Boot.pdfIntroduction to Spring Boot.pdf
Introduction to Spring Boot.pdf
 

ALL NEW OOP 2014

  • 1. November 2014 All New OOP 2014
  • 2. Contents INTRODUCTION .................................................................................................................................................... 2 DATABASE .............................................................................................................................................................. 3 1.1. Create File ............................................................................................................................................. 3 APPLICATION ........................................................................................................................................................ 5 2.1. Create File ............................................................................................................................................. 5 2.2. Connection Class ................................................................................................................................ 7 2.3. Module ................................................................................................................................................... 8 2.4. Entity ...................................................................................................................................................... 9 2.5. Control ................................................................................................................................................ 11 2.6. Boundary ........................................................................................................................................... 14 REPORTING ......................................................................................................................................................... 25 3.1. .rpt File ............................................................................................................................................... 25 3.2. Reporting Form ............................................................................................................................... 26 DEPLOYMENT .................................................................................................................................................... 30 4.1. File System on Target Machine ................................................................................................... 30 4.2. Deployment ....................................................................................................................................... 32 # All New OOP Tutorial 2014 # 1
  • 3. INTRODUCTION This article is dedicated to everyone who wants to know more about programming, especially to Microsoft Visual Studio in the next generation (VB.Net) and Ms. Access database. in this tutorial writter wouldn’t explain any detail about it. This tutorial only tell about basic programming. As OOP (Object Oriented Programming) is now such a general programming technique in dekstop programming, so we will use this technique to complete this article. Then make sure your self before continuing and finish this tutorial. Another note is, do not continue to the next step with skip a step before. Means you have to finish this tutorial step by step. If you have any trouble just tell us. At the end of this article you will see how to contact us. We will using Visual Basic.Net 2008 and Ms. Access 2007. Best Regards, Bambang Wiratmojo # All New OOP Tutorial 2014 # 2
  • 4. DATABASE 1.1. Create File Before we talking too much about creating such as an application sure we need to create the storage or we used to call as database. In this tutorial we gonna use microsoft access 2007 database. For first step we just need to know about stand alone database is ok, then next step we will talking about sharing database.  Open your microsoft access 2007 database in your pc.  Create file and named as PERSON_DB.  Create a table inside this database and named as PERSON_TABLE.  In Design View create some fields as below : Field Name Data Type Field Size PersonId Text 3 FirstName Text 35 LastName Text 35  Close your created database then open again using open exclusive. # All New OOP Tutorial 2014 # 3
  • 5.  Give this database a password using open exclusive access database  See at Database Tool Tab  Encrypt with password  Set database password as “123”  Then save this database at debug file folder in VB project, it wouldn’t be guaranteed by me that the application data running well if you dont put in here, trust me. # All New OOP Tutorial 2014 # 4
  • 6. APPLICATION 2.1. Create File As we have told at introduction we gonna use Visual Basic.Net 2008, so please make sure that you have instaled your own VB2008 correctly, because in this article we wouldn’t tell you how to install it.  Open your own Visual Studio, create a new project named as “ALL NEW OOP”  Create a system folders (BOUNDARY, CONTROL, ENTITY, MODUL) to classified as below picture. Using right click at Project Name (ALL NEW OOP) # All New OOP Tutorial 2014 # 5
  • 7. Then the folders should be as below picture  Create Deployment Project, using menu File  Add  New Project. Named as “DEPLOY APP” as above picture  Right click at DEPLOY APP  Prerequisites  At Choose which prerequisites to install, check .NET Framework 2.0 (x86), Windows Installer 3.1, .NET Framework 3.0 (x86), .NET Framework 3.5, Crystal Report Basic for Visual Studio 2008 (x86, x64), Visual Studio Tools for the Office system 3.0 Runtime  At Specify the install location fore prerequisites, select Download prerequisites from the same location as my application  Save you setting for the prerequisites to OK.  Still at DEPLOY APP, but move to the properties o Author : your name o Manufacturer : your company name o ManufacturerURL : your company URL o Product Name : ALL NEW OOP TUTORIAL 2014 o Support Phone : your phone number o Support URL : your email address o Title : DEPLOY APP # All New OOP Tutorial 2014 # 6
  • 8. 2.2. Connection Class  Right click at project file at solution explorer (ALL NEW OOP)  Add  Class (1st picture) then named as DB_Connection (2nd picture)  View code the created then write below source code Imports System.Data.OleDb Public Class DB_Connection 'Access Database 2007 Public DB_CONNECTION As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" _ & "Data Source=PERSON_DB.accdb;" _ & "Jet OLEDB:Database Password=123;") Public Function OPENCONNECTION() As OleDbConnection DB_CONNECTION.Open() Return DB_CONNECTION End Function Public Function CLOSECONNECTION() As OleDbConnection DB_CONNECTION.Close() Return DB_CONNECTION End Function End Class # All New OOP Tutorial 2014 # 7
  • 9. 2.3. Module  Move to Solution Explorer, right click at MODUL folder  Add  Module (1st picture), then named as VARIABELNYA (2nd picture)  View code the created then write below source code Imports System.Data.OleDb Module VARIABELNYA #Region "DEKLARASI" Public CMD As New OleDbCommand Public DTA As New OleDbDataAdapter Public DTR As OleDbDataReader Public DTS As New DataSet Public DTT As New DataTable #End Region #Region "NAMES" Public MePERSON_ENT As New PERSON_Entity Public MePERSON_CON As New PERSON_Control #End Region End Module # All New OOP Tutorial 2014 # 8
  • 10. 2.4. Entity  Move to Solution Explorer, right click at ENTITY folder  Add  Class, named as PERSON_Entity  View code the created then write below source code Public Class PERSON_Entity #Region "DECLARATION" Private _PersonId As String Private _FirstName As String Private _LastName As String #End Region # All New OOP Tutorial 2014 # 9
  • 11. #Region "PROPERTY" Public Overridable Sub DATA_PERSON(ByVal PersonId As String, _ ByVal FirstName As String, _ ByVal LastName As String) _PersonId = PersonId _FirstName = FirstName _LastName = LastName End Sub Public Property PersonId() As String Get Return _PersonId End Get Set(ByVal value As String) _PersonId = value End Set End Property Public Property FirstName() As String Get Return _FirstName End Get Set(ByVal value As String) _FirstName = value End Set End Property Public Property LastName() As String Get Return _LastName End Get Set(ByVal value As String) _LastName = value End Set End Property #End Region End Class # All New OOP Tutorial 2014 # 10
  • 12. 2.5. Control  Move to Solution Explorer, right click at CONTROL folder  Add  Class, named as PERSON_Control  View code the created then write below source code Imports System.Data.OleDb Public Class PERSON_Control Dim MeCONNECTION As New DB_Connection #Region "ACTION" Public Function SAVE_DATA(ByVal _PERSON As PERSON_Entity) As OleDbCommand MeCONNECTION.CLOSECONNECTION() CMD = New OleDbCommand("Insert Into PERSON_TABLE Values (PersonId, FirstName, LastName)", MeCONNECTION.OPENCONNECTION) CMD.CommandType = CommandType.Text Dim _PersonId As New OleDbParameter("@PersonId", OleDbType.Char, 3) _PersonId.Value = _PERSON.PersonId Dim _FirstName As New OleDbParameter("@FirstName", OleDbType.Char, 35) _FirstName.Value = _PERSON.FirstName Dim _LastName As New OleDbParameter("@LastName", OleDbType.Char, 35) _LastName.Value = _PERSON.LastName With CMD.Parameters .Add(_PersonId) .Add(_FirstName) .Add(_LastName) End With CMD.ExecuteNonQuery() CMD = New OleDbCommand("", MeCONNECTION.CLOSECONNECTION) Return CMD # All New OOP Tutorial 2014 # 11
  • 13. End Function Public Function EDIT_DATA(ByVal _PERSON As PERSON_Entity) As OleDbCommand MeCONNECTION.CLOSECONNECTION() CMD = New OleDbCommand("Update PERSON_TABLE Set FirstName=@FirstName, LastName=@LastName " & _ "Where PersonId=@PersonId", MeCONNECTION.OPENCONNECTION) CMD.CommandType = CommandType.Text Dim _PersonId As New OleDbParameter("@PersonId", OleDbType.Char, 3) _PersonId.Value = _PERSON.PersonId Dim _FirstName As New OleDbParameter("@FirstName", OleDbType.Char, 35) _FirstName.Value = _PERSON.FirstName Dim _LastName As New OleDbParameter("@LastName", OleDbType.Char, 35) _LastName.Value = _PERSON.LastName With CMD.Parameters .Add(_FirstName) .Add(_LastName) .Add(_PersonId) End With CMD.ExecuteNonQuery() CMD = New OleDbCommand("", MeCONNECTION.CLOSECONNECTION) Return CMD End Function Public Function DELETE_DATA(ByVal _PERSON As PERSON_Entity) As OleDbCommand MeCONNECTION.CLOSECONNECTION() CMD = New OleDbCommand("Delete From PERSON_TABLE Where PersonId=@PersonId", MeCONNECTION.OPENCONNECTION) CMD.CommandType = CommandType.Text Dim _PersonId As New OleDbParameter("@PersonId", OleDbType.Char, 3) _PersonId.Value = _PERSON.PersonId With CMD.Parameters .Add(_PersonId) End With CMD.ExecuteNonQuery() CMD = New OleDbCommand("", MeCONNECTION.CLOSECONNECTION) Return CMD End Function #End Region # All New OOP Tutorial 2014 # 12
  • 14. #Region "QUERY" Public Overridable Function AUTO_ID() As String MeCONNECTION.CLOSECONNECTION() DTT = New DataTable DTA = New OleDbDataAdapter("SELECT TOP 1 * FROM PERSON_TABLE ORDER BY PersonId DESC", MeCONNECTION.OPENCONNECTION) DTA.Fill(DTT) If DTT.Rows.Count = 0 Then Return "001" Else PLUS = Mid(DTT.Rows(0).Item("PersonId"), 3) If PLUS = 999 Then MsgBox("BARIS DATA MELAMPAUI BATAS SISTEM" & vbCrLf & _ "SILAHKAN KONTAK PENGEMBANG SISTEM ANDA", MsgBoxStyle.Critical) Return Nothing Else PLUS = PLUS + 1 Return PLUS.ToString.PadLeft(3, "0") End If End If End Function Public Function ISI_GRID() As DataView Try MeCONNECTION.CLOSECONNECTION() DTA = New OleDbDataAdapter("SELECT * FROM PERSON_TABLE ORDER BY PersonId ASC", MeCONNECTION.OPENCONNECTION) Try DTS = New DataSet DTS.Tables("PERSON_TABLE").Clear() Catch ex As Exception End Try DTA.Fill(DTS, "PERSON_TABLE") Dim GRID As New DataView(DTS.Tables("PERSON_TABLE")) Return GRID Catch ex As Exception Throw New Exception(ex.Message) End Try End Function Public Function CARI_DATA(ByVal CmbCARI As String, ByVal TxtCARI As String) As String Try Dim CARI As String MeCONNECTION.CLOSECONNECTION() CARI = "SELECT * FROM PERSON_TABLE WHERE " & CmbCARI & " LIKE '%" & TxtCARI & "%'" DTA = New OleDbDataAdapter(CARI, MeCONNECTION.OPENCONNECTION) Try DTS.Tables("PERSON_TABLE").Clear() # All New OOP Tutorial 2014 # 13
  • 15. Catch ex As Exception End Try DTA.Fill(DTS, "PERSON_TABLE") Dim GRID As New DataView(DTS.Tables("PERSON_TABLE")) Return CARI Catch ex As Exception Throw New Exception(ex.Message) End Try End Function #End Region End Class 2.6. Boundary  Move to Solution Explorer, add more folder inside BOUNDARY folder, Add FORM and REPORT, then at REPORT folder add child folder RFORM and RPT as below picture  Right click at FORM folder  Add  Windows Form, named as MAINFORM and set this as MDI Form application true. # All New OOP Tutorial 2014 # 14
  • 16.  Design the MAINFORM as below Detail : o Splitter (as separation between menu button and display form) o Button (PERSON (BtnPERSON), REPORTING(BtnREPORT)) o Lable (OOP TUTORIAL, 2013)  View code the created then write below source code Public Class MAINFORM Private Sub BtnPERSON_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPERSON.Click Dim Frm As New PERSON_LIST With Frm .MdiParent = Me .WindowState = FormWindowState.Maximized .Show() End With End Sub Private Sub BtnREPORT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnREPORT.Click Dim Frm As New FPRINT With Frm .MdiParent = Me .WindowState = FormWindowState.Maximized .Show() End With End Sub End Class # All New OOP Tutorial 2014 # 15
  • 17.  Right click at FORM folder  Add  Windows Form, named as PERSON_LIST  Design the PERSON_LIST as below Detail : o Datagridview (DgvPERSON) o Button (&NEW ENTRY (BtnNEWENTRY), &CLOSE (BtnCLOSE), &FIND (BtnFIND)) o Textbox (KEYWORD (TxtFIND)) o ComboBox (SELECT(CmbFIND)) o Lable (PERSON, SELECT, KEYWORD) o Datagridview setting, deselect all item # All New OOP Tutorial 2014 # 16
  • 18. o Click Edit Columns o Click Add  Name=DgvBtnEDIT, Type=DataGridViewButtonColumn, Header Text = EDIT o Double click, DefaultCellStyle o NullValue=EDIT o Click Add  Name=DgvBtnDELETE, Type=DataGridViewButtonColumn, Header Text = DELETE o Double click, DefaultCellStyle o NullValue=DELETE o Click Add  Name=ID, Type=DataGridViewTextboxColumn, o Header Text = ID o Name = PersonId o DataPropertyName = PersonId o Click Add  Name=FirstName, Type=DataGridViewTextboxColumn, o Header Text = FIRST NAME o Name = FirstName o DataPropertyName = FirstName o Click Add  Name=LastName, Type=DataGridViewTextboxColumn, o Header Text = LAST NAME o Name = LastName o DataPropertyName = LastName # All New OOP Tutorial 2014 # 17
  • 19.  View code the created then write below source code Public Class PERSON_LIST #Region "EVENT" Private Sub PERSON_LIST_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated Try DgvPERSON.DataSource = MePERSON_CON.ISI_GRID Call CAPITAL() Call FORMAT() Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Sub CmbFIND_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbFIND.SelectedIndexChanged TxtFIND.Text = "" TxtFIND.Focus() DgvPERSON.DataSource = MePERSON_CON.ISI_GRID End Sub Private Sub BtnFIND_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFIND.Click MePERSON_CON.CARI_DATA(CmbFIND.SelectedValue, TxtFIND.Text) End Sub Private Sub TxtFIND_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtFIND.KeyPress If e.KeyChar = Chr(13) Then BtnFIND.Focus() End If End Sub Private Sub BtnCLOSE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCLOSE.Click Me.Close() End Sub Private Sub BtnNEWENTRY_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNEWENTRY.Click Dim Frm As New PERSON With Frm .MdiParent = MAINFORM .WindowState = FormWindowState.Maximized .Show() End With End Sub Private Sub DgvPERSON_CellContentClick(ByVal sender As System.Object, ByVal e As # All New OOP Tutorial 2014 # 18
  • 20. System.Windows.Forms.DataGridViewCellEventArgs) Handles DgvPERSON.CellContentClick Dim Frm As New PERSON(INFO_DATA()) Select Case e.ColumnIndex Case 0 DgvBtnEDIT.Text = "EDIT" With Frm .MdiParent = MAINFORM .WindowState = FormWindowState.Maximized .BtnSAVE.Text = "&EDIT" .BtnCLOSE.Text = "&CANCEL" .Show() End With Case 1 DgvBtnDELETE.Text = "DELETE" With Frm .MdiParent = MAINFORM .WindowState = FormWindowState.Maximized .BtnSAVE.Text = "&DELETE" .BtnCLOSE.Text = "&CANCEL" .Show() End With End Select End Sub Private Function INFO_DATA() As PERSON_Entity With MePERSON_ENT .PersonId = DgvPERSON.Item(2, DgvPERSON.CurrentRow.Index).Value .FirstName = DgvPERSON.Item(3, DgvPERSON.CurrentRow.Index).Value .LastName = DgvPERSON.Item(4, DgvPERSON.CurrentRow.Index).Value End With Return MePERSON_ENT End Function #End Region #Region "OTOMATICALY" Private Sub FORMAT() With DgvPERSON .Columns(2).Width = 60 .Columns(3).Width = 200 .Columns(4).Width = 200 End With With CmbFIND DTT = New DataTable DTT.Columns.Add("Id") DTT.Columns.Add("Name") DTT.Rows.Add("PERSON_TABLE.PersonId", "ID") DTT.Rows.Add("PERSON_TABLE.FirstName", "FIRST NAME") # All New OOP Tutorial 2014 # 19
  • 21. DTT.Rows.Add("PERSON_TABLE.LastName", "LAST NAME") .DataSource = DTT .DisplayMember = "Name" .ValueMember = "Id" End With End Sub Private Sub CAPITAL() TxtFIND.CharacterCasing = CharacterCasing.Upper End Sub #End Region End Class  Right click at FORM folder  Add  Windows Form, named as PERSON  Design the PERSON as below Detail : o Lable (PERSON, FIRST NAME, LAST NAME, ID(LblPERSONID)) o Button (&INPUT (BtnSAVE), &CLOSE (BtnCLOSE)) o Textbox (FIRST NAME (TxtFIRSTNAME), LAST NAME(TxtLASTNAME))  View code the created then write below source code Public Class PERSON #Region "TEXT" Private Sub TEXTDEACTIVE() TxtFIRSTNAME.Enabled = False TxtLASTNAME.Enabled = False End Sub Private Sub TEXTACTIVE() TxtFIRSTNAME.Enabled = True TxtLASTNAME.Enabled = True End Sub # All New OOP Tutorial 2014 # 20
  • 22. Private Sub TEXTEMPTY() LblPERSONID.Text = "" TxtFIRSTNAME.Text = "" TxtLASTNAME.Text = "" End Sub Private Sub CAPITAL() TxtFIRSTNAME.CharacterCasing = CharacterCasing.Upper TxtLASTNAME.CharacterCasing = CharacterCasing.Upper End Sub Private Sub TEXTLIMIT() TxtFIRSTNAME.MaxLength = 35 TxtLASTNAME.MaxLength = 35 End Sub #End Region #Region "BUTTON" Private Sub BUTTONREADY() Call TEXTACTIVE() TxtFIRSTNAME.Focus() BtnSAVE.Text = "&SAVE" BtnCLOSE.Text = "&CANCEL" End Sub Private Sub BUTTONBEGIN() BtnSAVE.Text = "&INPUT" BtnCLOSE.Text = "&CLOSE" End Sub Private Sub BUTTONEDIT() Call TEXTACTIVE() TxtFIRSTNAME.Focus() BtnSAVE.Text = "&OK" BtnCLOSE.Text = "&CANCEL" End Sub Private Sub BUTTONDELETE() TxtFIRSTNAME.Focus() BtnCLOSE.Text = "&CANCEL" End Sub #End Region #Region "ACTION" Private Sub SAVE_DATA() If TxtFIRSTNAME.Text = "" Or TxtLASTNAME.Text = "" Then MsgBox("THERE ARE NO DATA TO BE SAVED !!!", MsgBoxStyle.Critical, Me.Text) Call TEXTDEACTIVE() Call TEXTEMPTY() Call BUTTONBEGIN() # All New OOP Tutorial 2014 # 21
  • 23. Else MePERSON_ENT.PersonId = LblPERSONID.Text MePERSON_ENT.FirstName = TxtFIRSTNAME.Text MePERSON_ENT.LastName = TxtLASTNAME.Text MePERSON_CON.SAVE_DATA(MePERSON_ENT) MsgBox("DATA HAS BEEN SAVED!!!", MsgBoxStyle.Information, Me.Text) Call TEXTDEACTIVE() Call TEXTEMPTY() Call BUTTONBEGIN() End If End Sub Private Sub EDIT_DATA() If TxtFIRSTNAME.Text = "" Or TxtLASTNAME.Text = "" Then MsgBox("THERE ARE NO DATA TO BE EDITED !!!", MsgBoxStyle.Critical, Me.Text) Call TEXTDEACTIVE() Call TEXTEMPTY() Call BUTTONBEGIN() Else MePERSON_ENT.PersonId = LblPERSONID.Text MePERSON_ENT.FirstName = TxtFIRSTNAME.Text MePERSON_ENT.LastName = TxtLASTNAME.Text MePERSON_CON.EDIT_DATA(MePERSON_ENT) MsgBox("DATA HAS BEEN EDITED!!!", MsgBoxStyle.Information, Me.Text) Call TEXTDEACTIVE() Call TEXTEMPTY() Call BUTTONBEGIN() End If End Sub Private Sub DELETE_DATA() If TxtFIRSTNAME.Text = "" Or TxtLASTNAME.Text = "" Then MsgBox("THERE ARE NO DATA TO BE DELETED !!!", MsgBoxStyle.Critical, Me.Text) Call TEXTDEACTIVE() Call TEXTEMPTY() Call BUTTONBEGIN() Else MePERSON_ENT.PersonId = LblPERSONID.Text MePERSON_CON.DELETE_DATA(MePERSON_ENT) MsgBox("DATA HAS BEEN DELETED!!!", MsgBoxStyle.Information, Me.Text) Call TEXTDEACTIVE() Call TEXTEMPTY() Call BUTTONBEGIN() End If End Sub #End Region # All New OOP Tutorial 2014 # 22
  • 24. #Region "EVENT" Private Sub CHOOSEACTION() Select Case BtnSAVE.Text Case "&INPUT" TEXTDEACTIVE() TEXTEMPTY() Case "&EDIT" TEXTDEACTIVE() Case "&DELETE" TEXTDEACTIVE() End Select End Sub Public Sub New() InitializeComponent() End Sub Public Sub New(ByVal MeOBJECT As PERSON_Entity) InitializeComponent() LblPERSONID.Text = MeOBJECT.PersonId TxtFIRSTNAME.Text = MeOBJECT.FirstName TxtLASTNAME.Text = MeOBJECT.LastName End Sub Private Sub BtnSAVE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSAVE.Click Select Case BtnSAVE.Text Case "&INPUT" BUTTONREADY() LblPERSONID.Text = MePERSON_CON.AUTO_ID Case "&SAVE" SAVE_DATA() Case "&DELETE" DELETE_DATA() Case "&EDIT" BUTTONEDIT() Case "&OK" EDIT_DATA() End Select End Sub Private Sub PERSON_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call CHOOSEACTION() Call CAPITAL() Call TEXTLIMIT() End Sub # All New OOP Tutorial 2014 # 23
  • 25. Private Sub BtnCLOSE_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCLOSE.Click Select Case BtnCLOSE.Text Case "&CANCEL" Call BUTTONBEGIN() Call TEXTDEACTIVE() Call TEXTEMPTY() Case "&CLOSE" Me.Close() End Select End Sub Private Sub TxtFIRSTNAME_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtFIRSTNAME.KeyPress If e.KeyChar = Chr(13) Then TxtLASTNAME.Focus() End If End Sub Private Sub TxtLASTNAME_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtLASTNAME.KeyPress If e.KeyChar = Chr(13) Then BtnSAVE.Focus() End If End Sub #End Region End Class # All New OOP Tutorial 2014 # 24
  • 26. REPORTING 3.1. .rpt File  Right click at RPT folder  Add  New Item  Reporting  Crystal Report, named as RPT_PERSON  Set Database Fields, Report Design as below picture  View Preview Data should be as follow, offcourse after inputed data # All New OOP Tutorial 2014 # 25
  • 27. 3.2. Reporting Form  Right click at RFORM folder  Add  Windows Form, named as FPERSON  Drag CrystalReportViewer into the form, names as CrysPERSON  View code the created then write below source code Imports CrystalDecisions.Shared Imports CrystalDecisions.CrystalReports.Engine Public Class FPERSON Dim strSELECT As String Dim MeCONNECTION As New DB_Connection Dim CrRpt As New ReportDocument Public Sub New(ByVal _strSELECT As String) InitializeComponent() strSELECT = _strSELECT End Sub Private Sub PRINT() Try CrRpt = New ALL_NEW_OOP.RPT_PERSON CrRpt.PrintOptions.PaperSource = PaperSource.Manual CrRpt.DataDefinition.RecordSelectionFormula = strSELECT Dim DTA As New OleDb.OleDbDataAdapter Dim DTS As New DataSet DTA = New OleDb.OleDbDataAdapter(strSELECT, MeCONNECTION.CLOSECONNECTION) DTA.Fill(DTS, "PERSON_TABLE") CrRpt.Load(Application.StartupPath & "/RPT_PERSON.rpt") CrRpt.SetDataSource(DTS) CrysPERSON.DisplayGroupTree = False CrysPERSON.ShowGroupTreeButton = False CrysPERSON.ShowExportButton = True CrysPERSON.ReportSource = CrRpt CrysPERSON.Refresh() CrysPERSON.RefreshReport() DTS.Clear() Catch ex As Exception MsgBox(ex.Message.ToString, MsgBoxStyle.OkOnly, "ERROR") End Try End Sub # All New OOP Tutorial 2014 # 26
  • 28. Private Sub FPERSON_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call PRINT() CrysPERSON.Zoom(85) End Sub End Class  Right click at RFORM folder  Add  Windows Form, named as FPRINT  Design the FPRINT as below Detail : o Lable (PREVIEW DATA, SELECT REPORT, SELECT QUERY, KEYWORD) o Button (&PRINT (BtnPRINTALLDATA), &PRINT (BtnQUERY)) o Combobox (SELECT REPORT (CmbALLDATA, CmbSELECTREPORT), SELECT QUERY (CmbQUERY)) o Textbox (KEYWORD (TxtKEYWORD)) # All New OOP Tutorial 2014 # 27
  • 29.  View code the created then write below source code Public Class FPRINT #Region "EVENT" Private Sub FPRINT_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call COMBO_PRINT() TxtKEYWORD.CharacterCasing = CharacterCasing.Upper End Sub Private Sub BtnPRINTALLDATA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPRINTALLDATA.Click Dim RptQuery As String = "SELECT * FROM PERSON_TABLE ORDER BY PersonId ASC" Select Case CmbALLDATA.Text Case "PERSON REPORT" Dim Frm As New FPERSON(RptQuery) With Frm .MdiParent = MAINFORM .WindowState = FormWindowState.Maximized .Show() End With End Select End Sub Private Sub BtnQUERY_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnQUERY.Click Dim RptQuery As String = "Select * From PERSON_TABLE Where " & CmbQUERY.SelectedValue & " Like '%" & TxtKEYWORD.Text & "%'" Select Case CmbSELECTREPORT.Text Case "PERSON REPORT" Dim Frm As New FPERSON(RptQuery) With Frm .MdiParent = MAINFORM .WindowState = FormWindowState.Maximized .Show() End With End Select End Sub Private Sub CmbQUERY_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CmbQUERY.SelectedValueChanged TxtKEYWORD.Text = "" TxtKEYWORD.Focus() End Sub Private Sub CmbSELECTREPORT_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CmbSELECTREPORT.SelectedValueChanged DTT = New DataTable # All New OOP Tutorial 2014 # 28
  • 30. DTT.Columns.Add("ID") DTT.Columns.Add("Name") DTT.Rows.Add("PersonId", "ID NUM") DTT.Rows.Add("FirstName", "FIRST NAME") DTT.Rows.Add("LastName", "LAST NAME") CmbQUERY.DataSource = DTT CmbQUERY.DisplayMember = "Name" CmbQUERY.ValueMember = "ID" End Sub Private Sub TxtKEYWORD_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtKEYWORD.KeyPress If e.KeyChar = Chr(13) Then BtnQUERY.Focus() End If End Sub #End Region #Region "OTOMATICALY" Private Sub COMBO_PRINT() Dim A As String = "PERSON REPORT" With CmbALLDATA .Items.Clear() .Items.Add(A) End With With CmbSELECTREPORT .Items.Clear() .Items.Add(A) End With With CmbQUERY .Items.Clear() .Items.Add("ID NUM") .Items.Add("FIRST NAME") .Items.Add("LAST NAME") End With End Sub #End Region End Class # All New OOP Tutorial 2014 # 29
  • 31. DEPLOYMENT 4.1. File System on Target Machine  Right click at DEPLOY APP project  View  File System  Select Application Folder as below picture.  At the right column, right click  Add  Assembly # All New OOP Tutorial 2014 # 30
  • 32.  Pointing to Tab Browse  Select ALL NEW OOP .exe  At the right column, right click  Add  File  Pointing to Tab Browse  Select PERSON_DB  At the right column, right click  Add  File  Pointing to Tab Browse  Select Minimize_Box_Blue # this is such as an additional file (shortcut), so may able to add this things or not this step is up to you...  At the right column, right click at ALL NEW OOP.exe  Create Shortcut to ALL NEW OOP.exe  Set the Shortcut properties as o Name : ALL NEW OOP o Icon : select our added icon before # All New OOP Tutorial 2014 # 31
  • 33. o Cut this shortcut, then paste in User’s Dekstop in left column under File System on Target Machine  Creata a new folder in User’s Programs Menu at left column under File System on Target Machine, and named as ALL NEW OOP  At the right column, right click at ALL NEW OOP.exe  Create Shortcut to ALL NEW OOP.exe  Set the Shortcut properties as o Name : ALL NEW OOP o Icon : select our added icon before  Cut this shortcut, then paste in User’s Programs Menu in left column under File System on Target Machine 4.2. Deployment  Right click at DEPLOY APP  Build  Wait for a second while until finish visual studio is Building our application become a setup application. Message information when building application is at below left side of visual studio. Wait until you can read at that place the word “Succeeded” # All New OOP Tutorial 2014 # 32
  • 34. Polymorphic372 Is a System Developer at Bridgestone Tire Indonesia. Graduated from STMIK Akademi Bina Insani Bekasi 2012 majoring Information and Technology. Wish to always dedicated him self to IT in Indonesia and the world. Contact : bambang.wiratmojo@bridgestone.co.id Blog : Polymorphic372.blogspot.com ALL NEW OOP TUTORIAL 2014 SUPPORTED BY CLAYMORECODE 2014 # All New OOP Tutorial 2014 # 33