Perancangan Kamus Digital Bahasa Indonesia – Nias Dengan Efek Suara Menggunakan Visual Basic 6.0

LAMPIRAN 1

Kode Program Menu Utama
Private Sub tengah()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub about_Click()
frmAbout.Show
End Sub
Private Sub CmdIndNis_Click()
frmMain.Show
Unload Me
End Sub
Private Sub Command1_Click()
frmMain2.Show
Unload Me
End Sub

Private Sub indonesianias_Click()
frmMain2.Show

End Sub
Private Sub kamushelp_Click()
FormHelp.Show
End Sub
Private Sub keluar_Click()
Unload Me
End Sub

Private Sub niasindonesia_Click()
frmMain.Show
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Time
Label2.Caption = Date
End Sub

Universitas Sumatera Utara

Private Sub Timer2_Timer()
Me.Width = Me.Width + 100

tengah
If Me.Width >= 6020 Then
Timer2.Enabled = False
tengah
End If
End Sub
Private Sub what_Click()
FormWhat.Show
End Sub

LAMPIRAN 2
Kode Program FrmMain2 (Indonesia – Nias)
Private Declare Function PlaySound Lib "winmm.dll" Alias _
"PlaySoundA" (ByVal lpszName As String, ByVal hModule As
Long, _
ByVal dwFlags As Long) As Long
Public Function PlayWaveFile(strFileName As String, Optional
blnAsync As Boolean) As Boolean
Dim lngFlags As Long
Const snd_sync = &H0

Const snd_Async = &H1
Const snd_Nodefault = &H2
Const snd_Filename = &H20000
lngFlags = snd_Nodefault Or snd_Filename Or snd_sync
If blnAsync Then lngFlags = lngFlags Or snd_Async
PlayWaveFile = PlaySound(strFileName, 0&, lngFlags)
End Function
Private Sub about_Click()
frmAbout.Show
frmMain2.Hide
End Sub
Private Sub CmdKembali_Click()
FormKamus.Show
frmMain2.Hide
End Sub
Private Sub Command1_Click()

Universitas Sumatera Utara

strSQL = "Select suara from NiasIndonesia where Istilahdesc ='"

& txtWord.Text & "'"
Set rssuara = New ADODB.Recordset
rssuara.Open strSQL, gAdoConn
If Not rssuara.EOF Then
retval = PlayWaveFile(App.Path & rssuara!suara, True)
Else
MsgBox "error"
End If
End Sub

Private Sub cmdDelete_Click()
Dim strDelete As String
strDelete = "Delete from NiasIndonesia Where Id = " &
gintIdItem.Text & ""
gAdoConn.Execute strDelete
PopData (strTextSearch)
txtWord.Text = ""
txtMeaning.Text = ""
End Sub
Private Sub cmdNew_Click()

txtWord.Text = ""
txtMeaning.Text = ""
End Sub
Private Sub cmdSave_Click()
Dim strSQL As String
Dim rs As ADODB.Recordset
If txtWord.Text = ""
MsgBox "Masukkan
Exit Sub
End If
If txtMeaning.Text =
MsgBox "Masukkan
Exit Sub
End If

Then
Kata. ", vbExclamation, "Alert"

"" Then
Arti Kata.", vbExclamation, "Alert"


strSQL
=
"Insert
NiasIndonesia(IstilahDesc,Istilah)Values('"
SQLSafe(txtWord.Text) & "','" & _
SQLSafe(txtMeaning.Text) & "')"
gAdoConn.Execute strSQL

into
&

PopData (strTextSearch)
txtWord.Text = ""

Universitas Sumatera Utara

txtMeaning.Text = ""
End Sub
Private Sub cmdUpdate_Click()

Dim strUpdate As String
strUpdate = "Update NiasIndonesia Set IstilahDesc = '" &
SQLSafe(txtWord) & "'," & _
"Istilah = '" & SQLSafe(txtMeaning) & "' Where Id = " &
gintIdItem & ""
gAdoConn.Execute strUpdate
PopData (strTextSearch)
txtWord.Text = ""
txtMeaning.Text = ""
End Sub
Private Sub Command2_Click()
FormKamus.Show
End Sub
Private Sub exit_Click()
Unload Me
End Sub

Private Sub Form_Load()
Me.Caption = App.Title
InitConnection

PopData (strTextSearch)
End Sub
Private Sub kamushelp_Click()
FormHelp.Show
End Sub
Private Sub keluar_Click()
Unload Me
End Sub
Private
Sub
lstView_ItemClick(ByVal
MSComctlLib.ListItem)
Dim intSelItem As Integer

Item

As

intSelItem = Item
txtWord.Text

lstView.ListItems(intSelItem).ListSubItems(1).Text

=

Universitas Sumatera Utara

txtMeaning.Text
lstView.ListItems(intSelItem).ListSubItems(2).Text
gintIdItem
lstView.ListItems(intSelItem).ListSubItems(3).Text
End Sub

=
=

Private Sub mnuAbout_Click()
frmAbout.Show
End Sub
Private Sub mnuExit_Click()
End

End Sub
Private Sub InitConnection()
Dim conDBString As String
conDBString
=
"Provider=Microsoft.Jet.OLEDB.4.0;
Source=" & App.Path & "\Kamus.mdb"

Data

Set gAdoConn = New ADODB.Connection
gAdoConn.ConnectionString = conDBString
gAdoConn.Open
End Sub
Private Sub PopData(strTextSearch As String)
Dim lstX As ListItem
Dim strSQL As String
Dim rs As ADODB.Recordset
Dim intCounter As Integer
If strTextSearch = "" Then

strSQL = "select * from NiasIndonesia Order by
IstilahDesc ASC"
Else
strSQL = "Select * from NiasIndonesia IstilahDesc " & _
"where IstilahDesc like '%" & strTextSearch & "%' order
by IstilahDesc asc"
End If

Set rs = New ADODB.Recordset
rs.Open strSQL, gAdoConn, 3, 1
lstView.ListItems.Clear

Universitas Sumatera Utara

With rs
If .RecordCount > 0 Then
.MoveFirst
intCounter = 1
While Not .EOF
Set lstX = lstView.ListItems.Add(, , intCounter)
lstX.ListSubItems.Add = Trim(!IstilahDesc)
lstX.ListSubItems.Add = Trim(!Istilah)
lstX.ListSubItems.Add = Trim(!Id)
intCounter = intCounter + 1
.MoveNext
Wend
End If
End With
End Sub

Private Sub niasindonesia_Click()
frmMain.Show
frmMain2.Hide
End Sub
Private Sub txtSearch_Change()
PopData (txtSearch.Text)
End Sub
Private Sub whatthis_Click()
FormWhat.Show
End Sub

LAMPIRAN 3
Kode Program FrmMain (Nias – Indonesia)
Private Declare Function PlaySound Lib "winmm.dll" Alias _
"PlaySoundA" (ByVal lpszName As String, ByVal hModule As
Long, _
ByVal dwFlags As Long) As Long
Public Function PlayWaveFile(strFileName As String, Optional
blnAsync As Boolean) As Boolean

Universitas Sumatera Utara

Dim lngFlags As Long
Const snd_sync = &H0
Const snd_Async = &H1
Const snd_Nodefault = &H2
Const snd_Filename = &H20000
lngFlags = snd_Nodefault Or snd_Filename Or snd_sync
If blnAsync Then lngFlags = lngFlags Or snd_Async
PlayWaveFile = PlaySound(strFileName, 0&, lngFlags)
End Function
Private Sub about_Click()
frmAbout.Show
frmMain.Hide
End Sub
Private Sub cmdDelete_Click()
Dim strDelete As String
strDelete = "Delete from NiasIndonesia Where Id = " &
gintIdItem.Text & ""
gAdoConn.Execute strDelete
PopData (strTextSearch)
txtWord.Text = ""
txtMeaning.Text = ""
End Sub

Private Sub CmdKembali_Click()
FormKamus.Show
frmMain.Hide
End Sub
Private Sub cmdNew_Click()
txtWord.Text = ""
txtMeaning.Text = ""
End Sub
Private Sub cmdSave_Click()
Dim strSQL As String
Dim rs As ADODB.Recordset
If txtWord.Text = ""
MsgBox "Masukkan
Exit Sub
End If
If txtMeaning.Text =
MsgBox "Masukkan
Exit Sub

Then
Kata. ", vbExclamation, "Alert"

"" Then
Arti Kata.", vbExclamation, "Alert"

Universitas Sumatera Utara

End If
strSQL
=
"Insert
NiasIndonesia(Istilah,IstilahDesc)Values('"
SQLSafe(txtWord.Text) & "','" & _
SQLSafe(txtMeaning.Text) & "')"
gAdoConn.Execute strSQL

into
&

PopData (strTextSearch)
txtWord.Text = ""
txtMeaning.Text = ""
End Sub

Private Sub cmdUpdate_Click()
Dim strUpdate As String
strUpdate = "Update NiasIndonesia Set Istilah = '" &
SQLSafe(txtWord) & "'," & _
"IstilahDesc = '" & SQLSafe(txtMeaning) & "' Where Id = " &
gintIdItem & ""
gAdoConn.Execute strUpdate
PopData (strTextSearch)
txtWord.Text = ""
txtMeaning.Text = ""
End Sub

Private Sub Command1_Click()
strSQL = "Select suara from NiasIndonesia where Istilah ='" &
txtWord.Text & "'"
Set rssuara = New ADODB.Recordset
rssuara.Open strSQL, gAdoConn
If Not rssuara.EOF Then
retval = PlayWaveFile(App.Path & rssuara!suara, True)
Else
MsgBox "error"
End If
End Sub
Private Sub Form_Load()
Me.Caption = App.Title
InitConnection
PopData (strTextSearch)
End Sub
Private Sub indonesianias_Click()

Universitas Sumatera Utara

frmMain2.Show
frmMain.Hide
End Sub
Private Sub keterangan_Click()
FormHelp.Show
End Sub
Private Sub kamushelp_Click()
FormHelp.Show
End Sub
Private Sub keluar_Click()
Unload Me
End Sub
Private
Sub
lstView_ItemClick(ByVal
MSComctlLib.ListItem)
Dim intSelItem As Integer
intSelItem = Item

Item

txtWord.Text
lstView.ListItems(intSelItem).ListSubItems(1).Text
txtMeaning.Text
lstView.ListItems(intSelItem).ListSubItems(2).Text
gintIdItem
lstView.ListItems(intSelItem).ListSubItems(3).Text
End Sub
Private Sub mnuAbout_Click()
frmAbout.Show
End Sub
Private Sub mnuExit_Click()
End
End Sub
Private Sub InitConnection()
Dim conDBString As String
conDBString
=
"Provider=Microsoft.Jet.OLEDB.4.0;
Source=" & App.Path & "\Kamus.mdb"

As

=
=
=

Data

Set gAdoConn = New ADODB.Connection
gAdoConn.ConnectionString = conDBString
gAdoConn.Open
End Sub
Private Sub PopData(strTextSearch As String)
Dim lstX As ListItem

Universitas Sumatera Utara

Dim strSQL As String
Dim rs As ADODB.Recordset
Dim intCounter As Integer
If strTextSearch = "" Then
strSQL = "select * from NiasIndonesia Order by Istilah
ASC"
Else
strSQL = "Select * from NiasIndonesia Istilah " & _
"where Istilah like '%" & strTextSearch & "%' order by
Istilah asc"
End If

Set rs = New ADODB.Recordset
rs.Open strSQL, gAdoConn, 3, 1
lstView.ListItems.Clear
With rs
If .RecordCount > 0 Then
.MoveFirst
intCounter = 1
While Not .EOF
Set lstX = lstView.ListItems.Add(, , intCounter)
lstX.ListSubItems.Add = Trim(!Istilah)
lstX.ListSubItems.Add = Trim(!IstilahDesc)
lstX.ListSubItems.Add = Trim(!Id)
intCounter = intCounter + 1
.MoveNext
Wend
End If
End With
End Sub
Private Sub txtSearch_Change()
PopData (txtSearch.Text)
End Sub
Private Sub whatthis_Click()
FormWhat.Show
End Sub
LAMPIRAN 4

Kode Program Kamus Help
Private Sub Cmd1_Click()

Universitas Sumatera Utara

Text1.Visible = False
Text2.Visible = True
Text3.Visible = False
End Sub
Private Sub Cmd2_Click()
Text1.Visible = False
Text2.Visible = False
Text3.Visible = True
End Sub
Private Sub Cmd3_Click()
Text1.Visible = True
Text2.Visible = False
Text3.Visible = False
End Sub
Private Sub Form_Load()
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
End Sub

LAMPIRAN 5
Kode Program What’s This
Private Sub cmdDelete_Click()
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = True
End Sub
Private Sub CmdKembali_Click()

Universitas Sumatera Utara

Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = True
Text5.Visible = False
Text6.Visible = False
End Sub
Private Sub cmdNew_Click()
Text1.Visible = False
Text2.Visible = False
Text3.Visible = True
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
End Sub
Private Sub cmdSave_Click()
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = True
Text6.Visible = False
End Sub
Private Sub cmdUpdate_Click()
Text1.Visible = False
Text2.Visible = True
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
End Sub
Private Sub Command1_Click()
Text1.Visible = True
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
End Sub
Private Sub Form_Load()
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False

Universitas Sumatera Utara

Text5.Visible = False
Text6.Visible = False
End Sub

LAMPIRAN 6

Kode Program About
Private Sub cmdClose_Click()
FormKamus.Show
frmAbout.Hide
End Sub
LAMPIRAN 7

Module
Public gAdoConn As ADODB.Connection

Public Function SQLSafe(strValue As String) As String
Dim strTemp1 As String
strTemp1 = Replace(strValue, "'", "''")
SQLSafe = strTemp1
End Function

Universitas Sumatera Utara