Saturday, March 23, 2013

Thursday, February 28, 2013

[Vb6] Mengetahui Serial ID Cpu

Private Function CpuId() As String
Dim computer As String
Dim wmi As Variant
Dim processors As Variant
Dim cpu As Variant
Dim cpu_ids As String

    computer = "."
    Set wmi = GetObject("winmgmts:" & _
        "{impersonationLevel=impersonate}!\\" & _
        computer & "\root\cimv2")
    Set processors = wmi.ExecQuery("Select * from " & _
        "Win32_Processor")

    For Each cpu In processors
        cpu_ids = cpu_ids & ", " & cpu.ProcessorID
    Next cpu
    If Len(cpu_ids) > 0 Then cpu_ids = Mid$(cpu_ids, 3)

    CpuId = cpu_ids
End Function

Cara ke 2
Command1_Click()
Dim wmiLocator As New WbemScripting.SWbemLocator
    Dim wmiService As WbemScripting.SWbemServices
    Dim wmiProc As WbemScripting.SWbemObject
    '
    'Establish a connection to WMI
    Set wmiService = wmiLocator.ConnectServer
    '
    'Enumerate the processor IDs
    For Each wmiProc In wmiService.InstancesOf("Win32_Processor")
        MsgBox wmiProc.ProcessorID
    Next
End sub


Wednesday, February 27, 2013

Wednesday, February 20, 2013

[Vb6] Filter Adodc dan Datagrid


Masukan kode ini di bawah ini
fungsinya untuk menampilkan text yang di masukan di text box dan hanya itu saja yang keluar ...

If Adodc1.Recordset.RecordCount <> 0 Then 
Adodc1.Recordset.Filter = "Fieldnya '*" & txtcari.Text & "*'" 
Else 
MsgBox "Data tidak Ada!!", vbExclamation 
End If
Cara kedua :

Filter data dengan Textbox
Adodc1.Recordset.Filter = "NamaKolom like '%" + Me.Text1.Text + "%'"
‘jika anda mengetik huruf A maka data-data yang ada huruf A akan di tampilkan


Filter data dengan 2 pencarian textbox
Adodc1.Recordset.Filter = "Kolom1 like '%" + Me.Text1.Text + "%'and Kolom2 like '%" + Me.Text2.Text + "%'"

Wednesday, February 13, 2013

[VB6] Menghitung jumlah item pada listview

 

Buat 1 buah command button dan masukan kode di bawah untuk menghitung jumlah item yang ada pada listview

Private Sub Command1_Click()
Dim i As Integer
Dim Jumlah as string
For i = 1 To ListView1.ListItems.Count '- 1
Jumlah = (ListView1.ListItems(i).Index)  '.SubItems(1))
Next
MsgBox Jumlah
End Sub