Legacy Programming Language
Complete Reference Guide
VB6 adalah bahasa pemrograman berbasis BASIC yang dikembangkan Microsoft. Dirilis tahun 1998, sekarang sudah obsolete tapi masih banyak digunakan di sistem legacy.
Project/
├── Project.vbp # Project file
├── Project.vbw # Workspace file
├── Form1.frm # Form definition
├── Module1.bas # Module code
├── Class1.cls # Class module
└── Resources/
└── Resource1.res # Resource file
Dim nama As String Dim usia As Integer Dim harga As Double Dim aktif As Boolean Dim arr() As String
| Type | Description |
|---|---|
| String | Text data |
| Integer | Whole number |
| Double | Decimal number |
| Boolean | True/False |
| Date | Date & Time |
| Object | Object reference |
If kondisi Then
' code
ElseIf kondisi2 Then
' code
Else
' code
End If
Select Case nilai
Case 1
' code
Case 2
' code
Case Else
' code
End Select
For i = 1 To 10
' code
Next i
Do While kondisi
' code
Loop
For Each item In collection
' code
Next item
Private Sub Command1_Click()
MsgBox "Button clicked!"
End Sub
Private Sub Form_Load()
' Initialize form
End Sub
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database.mdb;"
conn.Open
rs.Open "SELECT * FROM table", conn, adOpenStatic, adLockOptimistic
Do While Not rs.EOF
Debug.Print rs!fieldname
rs.MoveNext
Loop
rs.Close
conn.Close
On Error GoTo ErrorHandler
' code that might error
Exit Sub
ErrorHandler:
MsgBox Err.Description
Resume Next
End Sub
Err.Number - Error codeErr.Description - Error messageErr.Source - Error source' Class1.cls
Private m_Name As String
Public Property Get Name() As String
Name = m_Name
End Property
Public Property Let Name(value As String)
m_Name = value
End Property
Public Sub DoSomething()
' code
End Sub
Dim obj As New Class1 obj.Name = "Test" obj.DoSomething
regsvr32 Project.dll' Register regsvr32 Project.dll ' Unregister regsvr32 /u Project.dll
| File | Purpose |
|---|---|
| msvbvm60.dll | VB Runtime |
| COMDLG32.OCX | Common Dialogs |
| MSCOMCTL.OCX | Windows Common Controls |
| MSADODC.OCX | Data Control |
Apa ekstensi file project VB6?
VB6 menggunakan bahasa pemrograman apa?
Apa fungsi Form di VB6?