[x] Anda belum terdaftar di forum kami. Klik REGISTER untuk melakukan registrasi. || Atau LOGIN di sini.
IF UNIKOM
Please login or register.

Login with username, password and session length
Advanced search  

News:

The Official Website is http://if.unikom.ac.id

Privacy
Pages: [1] 2

Author Topic: VB.Net by kiddo7th  (Read 19353 times)

0 Members and 1 Guest are viewing this topic.

« on: April 24, 2009, 06:50:15 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
VB.Net by kiddo7th
« on: April 24, 2009, 06:50:15 PM »
Visual Basic .Net are inside!
Logged

«Reply #1 on: April 24, 2009, 06:56:18 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #1 on: April 24, 2009, 06:56:18 PM »
Chapter 01. Introduce
VB.Net atau dikenal juga dengan Visual Studio .Net ini telah cukup mengalami perkembangan.
Dimulai dari adanya visual studio 2003, 2005, Express Edition dan juga Visual Studio 2008.

Konsep bahasa pemrograman di dalamnya sebetulnya terdapat 3 bahasa pemrograman dasar,
yakni : Visual Basic, C++ dan C#.

Dalam penerapannya, dengan .net ini kita dapat menciptakan desktop aplikasi, mobile phone aplikasi,
aplikasi berbasis console maupun website.
Logged

«Reply #2 on: April 24, 2009, 06:59:18 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #2 on: April 24, 2009, 06:59:18 PM »
Chapter 02. Variabel and Code
 Pada chapter ini akan saya berikan beberapa coding yang cukup sering digunakan dalam penerapan.


================================================================================================
Menggunakan Objek Command - akses database via command / sQL
================================================================================================

tuliskan : Import System.Data.OleDb di awal code
   'untuk mengimport OleDb agar dapat berjalan di aplikasi yang akan dibuat

Dim com As New OledbCommand
   'memberikan variabel (com) sebagai command untuk koneksi database

com.Connection = con
   'menentukan sumber koneksi untuk variabel (com)

com.CommandText = "gunakan sintax SQL"
   'seperti perintah select, insert, update ataupun delete

kemudian eksekusi perintah.
   'pilihan eksekusi :
    - ExecuteReader
    - ExecuteNonQuery
    - ExecuteScalar


================================================================================================
 
« Last Edit: April 24, 2009, 07:03:04 PM by kiddo7th »
Logged

«Reply #3 on: April 24, 2009, 07:03:43 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #3 on: April 24, 2009, 07:03:43 PM »
=================================================================================================
ExecuteReader - untuk membaca data dari database
=================================================================================================

con.Open()
   'buka koneksi database

Dim com As New OledbCommand

com.Connection = con
com.CommandText = "Select * from Crazy_Tabel"
   'ambil seluruh data dari Tabel Crazy

Dim dr As OledbDataReader = com.ExecuteReader()
   'mengaktifkan datareader

While dr.Read
   ...
   ...
   dr(0) ----> data pada kolom 0
   
End While

dr.close()

con.Close()
   'tutup koneksi database


=================================================================================================
Logged

«Reply #4 on: April 24, 2009, 07:04:07 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #4 on: April 24, 2009, 07:04:07 PM »
=================================================================================================
ExecuteNonQuery - digunakan untuk perintah INSERT,UPDATE,DELETE
=================================================================================================

Dim com As New OledbCommand

com.Connection = con
com.CommandText = "DELETE FROM MsBarang WHERE kdBrg='BR001'"
   'ambil seluruh data dari Tabel Crazy

com.ExecuteNonQuery()


=================================================================================================
Logged

«Reply #5 on: April 24, 2009, 07:04:35 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #5 on: April 24, 2009, 07:04:35 PM »
=================================================================================================
ExecuteScalar - digunakan untuk mendapatkan nilai skalar( 1 baris dan 1 kolom )
=================================================================================================

Dim com As New OledbCommand

com.Connection = con
com.CommandText = "Select Sum(Benefit) FROM Crazy_Tabel WHERE kode='CRZ00007'"
   'ambil field Nama Orang dari Tabel Crazy

Dim total_keuntungan As String = com.ExecuteScalar().toString()


=================================================================================================
Logged

«Reply #6 on: April 24, 2009, 07:05:32 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #6 on: April 24, 2009, 07:05:32 PM »
=================================================================================================
Print & View Report - Menciptakan laporan yang dapat dilihat dan dicetak
=================================================================================================

Dim Variable_Form As New Form_Name_Report
   'menginisialisasi variabel form sebagai form (baru) pada form report


Dim Variable_Report As New CrystalDecisions.CrystalReports.Engine.ReportDocument
   'inisialisasi pembuatan report

Variable_Report.Load(lokasi report yang akan dibaca)
   'contoh :     C:\Project\crazy.rpt

Variable_Report.SetDatabaseLogon(FileUser, FilePass, FileName, FileName)
   'jika menginginkan ada autentifikasi siapa yang akan melakukan proses ini terlebih dahulu

Variable_Form.CrystalReportViewer1.ReportSource = Variable_Report
   'menentukan source untuk report yang akan ditampilkan

Variable_Form.CrystalReportViewer1.SelectionFormula = ... tuliskan batasan nya disini
 'contoh : "    {Crazy_Tabel.kode}      =  '"  &  ComboBox1.Text  &  "' "  &
 '         "and {Crazy_Tabel.waktu}     >  #"  &  TglMulai        &  "# "  &
 '         "and {Crazy_Tabel.waktu}     <  #"  &  tglakhir        &  "#"

 '         month({table.date})               ----> untuk mengambil bulan dari tgl yang ada
 '         monthname(month({table.date}))    ----> untuk mengambil nama bulan dari tgl yang ada

 '         year({table.date})                ----> untuk mengambil tahun dari tgl yang ada

Variable_Form.WindowState = FormWindowState.Maximized
   'agar form pada saat running dalam keadaan maximize

Variable_Form.ShowDialog()
   'tampilkan form


=================================================================================================
Logged

«Reply #7 on: April 24, 2009, 09:13:01 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #7 on: April 24, 2009, 09:13:01 PM »
=========================================================
Transformasi Angka ke String (Manual) - Digunakan untuk pembilang dalam
check atau faktur (maaf yg sederhana nya blum bikin)
=========================================================

Code: vb
Me.txtTotal.Text = Ttl

Dim Ttl_Text As String

Dim miliar, juta, ratus1, ratus2, ratus3, ribu1, ribu2, puluh1, puluh2, puluh3, puluh4 As String

If (Ttl > 10000000000) Then
puluh4 = Ttl  10000000000
End If

If (Ttl > 1000000000) Then
miliar = (Ttl Mod 10000000000)  1000000000
End If

If (Ttl > 100000000) Then
ratus3 = (Ttl Mod 1000000000)  100000000
End If

If (Ttl > 10000000) Then
puluh3 = (Ttl Mod 100000000)  10000000
End If

If (Ttl > 1000000) Then
juta = (Ttl Mod 10000000)  1000000
End If

If (Ttl > 100000) Then
ratus2 = (Ttl Mod 1000000)  100000
End If

If (Ttl > 10000) Then
puluh2 = (Ttl Mod 100000)  10000
End If

If (Ttl > 1000) Then
ribu2 = (Ttl Mod 10000)  1000
End If

If (Ttl > 100) Then
ratus1 = (Ttl Mod 1000)  100
End If

If (Ttl > 10) Then
puluh1 = (Ttl Mod 100)  10
End If

If (Ttl > 1) Then
ribu1 = (Ttl Mod 10)
End If

If (puluh4 = "0") Then
puluh4 = " "
ElseIf (puluh4 = "2") Then
puluh4 = "dua puluh "
ElseIf (puluh4 = "3") Then
puluh4 = "tiga puluh "
ElseIf (puluh4 = "4") Then
puluh4 = "empat puluh "
ElseIf (puluh4 = "5") Then
puluh4 = "lima puluh "
ElseIf (puluh4 = "6") Then
puluh4 = "enam puluh "
ElseIf (puluh4 = "7") Then
puluh4 = "tujuh puluh "
ElseIf (puluh4 = "8") Then
puluh4 = "delapan puluh "
ElseIf (puluh4 = "9") Then
puluh4 = "sembilan puluh "
End If

If (puluh4 = "1") And (miliar = "0") Then
puluh4 = " "
miliar = "sepuluh miliar "
ElseIf (puluh4 = "1") And (miliar = "1") Then
puluh4 = " "
miliar = "sebelas miliar "
ElseIf (puluh4 = "1") And (miliar = "2") Then
puluh4 = " "
miliar = "dua belas miliar "
ElseIf (puluh4 = "1") And (miliar = "3") Then
puluh4 = " "
miliar = "tiga belas miliar "
ElseIf (puluh4 = "1") And (miliar = "4") Then
puluh4 = " "
miliar = "empat belas miliar "
ElseIf (puluh4 = "1") And (miliar = "5") Then
puluh4 = " "
miliar = "lima belas miliar "
ElseIf (puluh4 = "1") And (miliar = "6") Then
puluh4 = " "
miliar = "enam belas miliar "
ElseIf (puluh4 = "1") And (miliar = "7") Then
puluh4 = " "
miliar = "tujuh belas miliar "
ElseIf (puluh4 = "1") And (miliar = "8") Then
puluh4 = " "
miliar = "delapan belas miliar "
ElseIf (puluh4 = "1") And (miliar = "9") Then
puluh4 = " "
miliar = "sembilan belas miliar "
ElseIf (puluh4 <> "1") And (miliar = "1") Then
miliar = "satu miliar "
ElseIf (puluh4 <> "1") And (miliar = "2") Then
miliar = "dua miliar "
ElseIf (puluh4 <> "1") And (miliar = "3") Then
miliar = "tiga miliar "
ElseIf (puluh4 <> "1") And (miliar = "4") Then
miliar = "empat miliar "
ElseIf (puluh4 <> "1") And (miliar = "5") Then
miliar = "lima miliar "
ElseIf (puluh4 <> "1") And (miliar = "6") Then
miliar = "enam miliar "
ElseIf (puluh4 <> "1") And (miliar = "7") Then
miliar = "tujuh miliar "
ElseIf (puluh4 <> "1") And (miliar = "8") Then
miliar = "delapan miliar "
ElseIf (puluh4 <> "1") And (miliar = "9") Then
miliar = "sembilan miliar "
ElseIf (puluh4 <> "1") And (miliar = "0") Then
miliar = "miliar "
End If

If (ratus3 = "1") Then
ratus3 = "seratus "
ElseIf (ratus3 = "2") Then
ratus3 = "dua ratus "
ElseIf (ratus3 = "3") Then
ratus3 = "tiga ratus "
ElseIf (ratus3 = "4") Then
ratus3 = "empat ratus "
ElseIf (ratus3 = "5") Then
ratus3 = "lima ratus "
ElseIf (ratus3 = "6") Then
ratus3 = "enam ratus "
ElseIf (ratus3 = "7") Then
ratus3 = "tujuh ratus "
ElseIf (ratus3 = "8") Then
ratus3 = "delapan ratus "
ElseIf (ratus3 = "9") Then
ratus3 = "sembilan ratus "
Else
ratus3 = ""
End If

If (puluh3 = "0") Then
puluh3 = " "
ElseIf (puluh3 = "2") Then
puluh3 = "dua puluh "
ElseIf (puluh3 = "3") Then
puluh3 = "tiga puluh "
ElseIf (puluh3 = "4") Then
puluh3 = "empat puluh "
ElseIf (puluh3 = "5") Then
puluh3 = "lima puluh "
ElseIf (puluh3 = "6") Then
puluh3 = "enam puluh "
ElseIf (puluh3 = "7") Then
puluh3 = "tujuh puluh "
ElseIf (puluh3 = "8") Then
puluh3 = "delapan puluh "
ElseIf (puluh3 = "9") Then
puluh3 = "sembilan puluh "
End If

If (puluh3 = "1") And (juta = "0") Then
puluh3 = " "
juta = "sepuluh juta "
ElseIf (puluh3 = "1") And (juta = "1") Then
puluh3 = " "
juta = "sebelas juta "
ElseIf (puluh3 = "1") And (juta = "2") Then
puluh3 = " "
juta = "dua belas juta "
ElseIf (puluh3 = "1") And (juta = "3") Then
puluh3 = " "
juta = "tiga belas juta "
ElseIf (puluh3 = "1") And (juta = "4") Then
puluh3 = " "
juta = "empat belas juta "
ElseIf (puluh3 = "1") And (juta = "5") Then
puluh3 = " "
juta = "lima belas juta "
ElseIf (puluh3 = "1") And (juta = "6") Then
puluh3 = " "
juta = "enam belas juta "
ElseIf (puluh3 = "1") And (juta = "7") Then
puluh3 = " "
juta = "tujuh belas juta "
ElseIf (puluh3 = "1") And (juta = "8") Then
puluh3 = " "
juta = "delapan belas juta "
ElseIf (puluh3 = "1") And (juta = "9") Then
puluh3 = " "
juta = "sembilan belas juta "
ElseIf (puluh3 <> "1") And (juta = "1") Then
juta = "satu juta "
ElseIf (puluh3 <> "1") And (juta = "2") Then
juta = "dua juta "
ElseIf (puluh3 <> "1") And (juta = "3") Then
juta = "tiga juta "
ElseIf (puluh3 <> "1") And (juta = "4") Then
juta = "empat juta "
ElseIf (puluh3 <> "1") And (juta = "5") Then
juta = "lima juta "
ElseIf (puluh3 <> "1") And (juta = "6") Then
juta = "enam juta "
ElseIf (puluh3 <> "1") And (juta = "7") Then
juta = "tujuh juta "
ElseIf (puluh3 <> "1") And (juta = "8") Then
juta = "delapan juta "
ElseIf (puluh3 <> "1") And (juta = "9") Then
juta = "sembilan juta "
ElseIf (puluh3 <> "1") And (juta = "0") Then
juta = "juta "
End If

If (ratus2 = "1") Then
ratus2 = "seratus "
ElseIf (ratus2 = "2") Then
ratus2 = "dua ratus "
ElseIf (ratus2 = "3") Then
ratus2 = "tiga ratus "
ElseIf (ratus2 = "4") Then
ratus2 = "empat ratus "
ElseIf (ratus2 = "5") Then
ratus2 = "lima ratus "
ElseIf (ratus2 = "6") Then
ratus2 = "enam ratus "
ElseIf (ratus2 = "7") Then
ratus2 = "tujuh ratus "
ElseIf (ratus2 = "8") Then
ratus2 = "delapan ratus "
ElseIf (ratus2 = "9") Then
ratus2 = "sembilan ratus "
Else
ratus2 = ""
End If

If (puluh2 = "0") Then
puluh2 = " "
ElseIf (puluh2 = "2") Then
puluh2 = "dua puluh "
ElseIf (puluh2 = "3") Then
puluh2 = "tiga puluh "
ElseIf (puluh2 = "4") Then
puluh2 = "empat puluh "
ElseIf (puluh2 = "5") Then
puluh2 = "lima puluh "
ElseIf (puluh2 = "6") Then
puluh2 = "enam puluh "
ElseIf (puluh2 = "7") Then
puluh2 = "tujuh puluh "
ElseIf (puluh2 = "8") Then
puluh2 = "delapan puluh "
ElseIf (puluh2 = "9") Then
puluh2 = "sembilan puluh "
End If

If (puluh2 = "1") And (ribu2 = "0") Then
puluh2 = " "
ribu2 = "sepuluh ribu "
ElseIf (puluh2 = "1") And (ribu2 = "1") Then
puluh2 = " "
ribu2 = "sebelas ribu "
ElseIf (puluh2 = "1") And (ribu2 = "2") Then
puluh2 = " "
ribu2 = "dua belas ribu "
ElseIf (puluh2 = "1") And (ribu2 = "3") Then
puluh2 = " "
ribu2 = "tiga belas ribu "
ElseIf (puluh2 = "1") And (ribu2 = "4") Then
puluh2 = " "
ribu2 = "empat belas ribu "
ElseIf (puluh2 = "1") And (ribu2 = "5") Then
puluh2 = " "
ribu2 = "lima belas ribu "
ElseIf (puluh2 = "1") And (ribu2 = "6") Then
puluh2 = " "
ribu2 = "enam belas ribu "
ElseIf (puluh2 = "1") And (ribu2 = "7") Then
puluh2 = " "
ribu2 = "tujuh belas ribu "
ElseIf (puluh2 = "1") And (ribu2 = "8") Then
puluh2 = " "
ribu2 = "delapan belas ribu "
ElseIf (puluh2 = "1") And (ribu2 = "9") Then
puluh2 = " "
ribu2 = "sembilan belas ribu "
ElseIf (puluh2 = "") And (ribu2 = "1") Then
ribu2 = "seribu "
ElseIf (puluh2 <> "1") And (ribu2 = "1") Then
ribu2 = "satu ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "2") Then
ribu2 = "dua ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "3") Then
ribu2 = "tiga ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "4") Then
ribu2 = "empat ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "5") Then
ribu2 = "lima ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "6") Then
ribu2 = "enam ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "7") Then
ribu2 = "tujuh ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "8") Then
ribu2 = "delapan ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "9") Then
ribu2 = "sembilan ribu "
ElseIf (puluh2 <> "1") And (ribu2 = "0") Then
ribu2 = "ribu "
End If

If (ratus1 = "1") Then
ratus1 = "seratus "
ElseIf (ratus1 = "2") Then
ratus1 = "dua ratus "
ElseIf (ratus1 = "3") Then
ratus1 = "tiga ratus "
ElseIf (ratus1 = "4") Then
ratus1 = "empat ratus "
ElseIf (ratus1 = "5") Then
ratus1 = "lima ratus "
ElseIf (ratus1 = "6") Then
ratus1 = "enam ratus "
ElseIf (ratus1 = "7") Then
ratus1 = "tujuh ratus "
ElseIf (ratus1 = "8") Then
ratus1 = "delapan ratus "
ElseIf (ratus1 = "9") Then
ratus1 = "sembilan ratus "
Else
ratus1 = ""
End If

If (puluh1 = "0") Then
puluh1 = " "
ElseIf (puluh1 = "2") Then
puluh1 = "dua puluh "
ElseIf (puluh1 = "3") Then
puluh1 = "tiga puluh "
ElseIf (puluh1 = "4") Then
puluh1 = "empat puluh "
ElseIf (puluh1 = "5") Then
puluh1 = "lima puluh "
ElseIf (puluh1 = "6") Then
puluh1 = "enam puluh "
ElseIf (puluh1 = "7") Then
puluh1 = "tujuh puluh "
ElseIf (puluh1 = "8") Then
puluh1 = "delapan puluh "
ElseIf (puluh1 = "9") Then
puluh1 = "sembilan puluh "
End If

If (puluh1 = "1") And (ribu1 = "0") Then
puluh1 = " "
ribu1 = "sepuluh "
ElseIf (puluh1 = "1") And (ribu1 = "1") Then
puluh1 = " "
ribu1 = "sebelas "
ElseIf (puluh1 = "1") And (ribu1 = "2") Then
puluh1 = " "
ribu1 = "dua belas "
ElseIf (puluh1 = "1") And (ribu1 = "3") Then
puluh1 = " "
ribu1 = "tiga belas "
ElseIf (puluh1 = "1") And (ribu1 = "4") Then
puluh1 = " "
ribu1 = "empat belas "
ElseIf (puluh1 = "1") And (ribu1 = "5") Then
puluh1 = " "
ribu1 = "lima belas "
ElseIf (puluh1 = "1") And (ribu1 = "6") Then
puluh1 = " "
ribu1 = "enam belas "
ElseIf (puluh1 = "1") And (ribu1 = "7") Then
puluh1 = " "
ribu1 = "tujuh belas "
ElseIf (puluh1 = "1") And (ribu1 = "8") Then
puluh1 = " "
ribu1 = "delapan belas "
ElseIf (puluh1 = "1") And (ribu1 = "9") Then
puluh1 = " "
ribu1 = "sembilan belas "
ElseIf (puluh1 = "") And (ribu1 = "1") Then
ribu1 = "satu "
ElseIf (puluh1 <> "1") And (ribu1 = "1") Then
ribu1 = "satu "
ElseIf (puluh1 <> "1") And (ribu1 = "2") Then
ribu1 = "dua "
ElseIf (puluh1 <> "1") And (ribu1 = "3") Then
ribu1 = "tiga "
ElseIf (puluh1 <> "1") And (ribu1 = "4") Then
ribu1 = "empat "
ElseIf (puluh1 <> "1") And (ribu1 = "5") Then
ribu1 = "lima "
ElseIf (puluh1 <> "1") And (ribu1 = "6") Then
ribu1 = "enam "
ElseIf (puluh1 <> "1") And (ribu1 = "7") Then
ribu1 = "tujuh "
ElseIf (puluh1 <> "1") And (ribu1 = "8") Then
ribu1 = "delapan "
ElseIf (puluh1 <> "1") And (ribu1 = "9") Then
ribu1 = "sembilan "
ElseIf (puluh1 <> "1") And (ribu1 = "0") Then
ribu1 = ""
End If

Ttl_Text = puluh4 & miliar & ratus3 & puluh3 & juta & ratus2 & puluh2 & ribu2 & ratus1 & puluh1 & ribu1 & "rupiah"

Me.txtTotalKata.Text = Ttl_Text

=========================================================
« Last Edit: April 27, 2009, 01:34:35 PM by kiddo7th »
Logged

«Reply #8 on: April 24, 2009, 09:14:26 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #8 on: April 24, 2009, 09:14:26 PM »
=========================================================
Pengisian ID Otomatis (manual) - Digunakan untuk mengisi field ID secara otomatis
(mengurangi double primary key)
=========================================================

Dim Con2 As New SqlConnection
Dim Da2 As SqlDataAdapter
Dim Ds2 As New DataSet()
Dim Dt2 As DataTable
Dim Nmr_FKJ As String

Con2.ConnectionString = ---> koneksi ke database

Con2.Open()

Da2 = New SqlDataAdapter("SELECT TOP 1 no_penjualan FROM penjualan ORDER BY no_penjualan DESC", Con2)
Da2.Fill(Ds2)
Dt2 = Ds2.Tables(0)

Dim i As Integer
Dim Akhir As Integer

i = Dt2.Rows.Count

If (i = 0) Then
Nmr_FKJ = "FKJ0000001"
Else
Akhir = Mid(Dt2.Rows(0)("no_penjualan"), 4)
Akhir = Akhir + 1

If (Akhir < 10) Then
Nmr_FKJ = "FKJ000000" & Akhir

ElseIf (Akhir < 100) Then
Nmr_FKJ = "FKJ00000" & Akhir

ElseIf (Akhir < 1000) Then
Nmr_FKJ = "FKJ0000" & Akhir

ElseIf (Akhir < 10000) Then
Nmr_FKJ = "FKJ000" & Akhir

ElseIf (Akhir < 100000) Then
Nmr_FKJ = "FKJ00" & Akhir

ElseIf (Akhir < 1000000) Then
Nmr_FKJ = "FKJ0" & Akhir

Else
Nmr_FKJ = "FKJ" & Akhir

End If
End If

Con2.Close()

Me.label_ID.Text = Nmr_FKJ


=========================================================
Logged

«Reply #9 on: April 24, 2009, 09:15:49 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #9 on: April 24, 2009, 09:15:49 PM »
=========================================================
Regular Expresion - Salah Satu Bentuk Validasi pada Inputan Data
=========================================================

If (Request("string_dari_form_sebelumnya") <> "") Then
    'request('string') ---> mengambil string / inputan dari form sebelumnya

Dim RegexZip As String = "^d*$"
    'Menentukan bahwa validasi pengisian hanya boleh angka (d) dan tidak terbatas jumlahnya (*)

If Not (Regex.IsMatch(Request("string_dari_form_sebelumnya"), RegexZip)) Then
    'kode untuk menentukan apakah inputan telah sesuai (IsMatch) dengan validasi yg tlh ditentukan

    'jika tidak sesuai, maka tulis... <argument>
Pesan_Zip_Code = " bla... bla... bla... "

    'jika sesuai, maka tulis... <argument>

Else

Pesan_Zip_Code = " bla... bla... bla... "

End If

End If


If Not IsNumeric(INPUTAN) Then
     MsgBox "masukan angka",
EndIf

    'membaca untuk mengecheck apakah inputan telah numeric atau belum?
    'jika bukan numeric, maka keluar pesan!



Regular Expression Lainnya :

- Email                       :   \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
  .contoh : [email protected]

- URL                         :   http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
  .contoh : http://www.crazyganx.com

- KTP / Identitas       :   ^\d+([-.]\d+)*\.\d+([-.]\d+)*$
  .contoh : 112233.445566.778899

=========================================================
« Last Edit: May 20, 2009, 10:46:48 AM by kiddo7th »
Logged

«Reply #10 on: April 24, 2009, 09:17:29 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #10 on: April 24, 2009, 09:17:29 PM »
=========================================================
Provider Database - Access, OleDB, Oracle
=========================================================

Access = Microsoft.Jet.OLEDB.4.0
OleDB = MSDASQL / SQLOLEDB
Oracle = MSDAORA

=========================================================
Logged

«Reply #11 on: April 24, 2009, 09:22:45 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #11 on: April 24, 2009, 09:22:45 PM »
=====================================================================================
Split Character
=====================================================================================

Dim delimStr As String = ","
Dim delimiter As Char() = delimStr.ToCharArray()
Dim words As String = "String yang akan di split"
Dim split As String() = Nothing
    split = words.Split(delimiter, Dtt2.Rows.Count, StringSplitOptions.RemoveEmptyEntries)
Dim s As String

For Each s In split
    Response.Write("<li> " & s & "</li>")
Next s


=====================================================================================
Logged

«Reply #12 on: April 24, 2009, 09:25:56 PM »

kiddo7th

  • SD Senior
  • *
  • Reputation Power: 4
  • kiddo7th belum punya pengaruh.
  • Offline Offline
  • Posts: 201

  • Aktivitas bulan ini
    0%
  • Lokasi: Langit Sebagai Atap Rumahku
  • Orang Gila ajah masih lebih care
Re: VB.Net
« Reply #12 on: April 24, 2009, 09:25:56 PM »
=========================================================
Trim Character - Memotong kata / karakter
=========================================================

ada kasus misal :
%%12%%
%%13%%
%%12356%%
%%AVHGDVBA%%

nah jika kita ingin mengambil data tanpa tanda "%"
bagaimana caranya



Berikut langkah2nya :
1. Ambil data sumber tersebut (misal sumber berasal dari textbox1), maka :
 
    Dim MyString As String = TextBox1.Text
2. Deklarasikan karakter apa yang akan dihilangkan (untuk saat ini adalah karakter %) :
    Dim MyChar As Char() = {"%"c}
    ini dapat eksekusi beberapa karakter sekaligus juga, misal :[/list]
      Dim MyChar As Char() = {"r"c, "A"c, "%"c, "$"c }[/list]
      3. Hapus karakter tersebut:
        Dim NewString As String = MyString.TrimEnd(MyChar)
      (jika karakter yg ingin di hapus ada di belakang)
        Dim NewString2 As String = NewString.TrimStart(MyChar)
      (jika karakter yg ingin di hapus ada di depan)
        Dim NewString3 As String = NewString.Trim(MyChar)

      (jika karakter yg ingin di hapus tidak peduli ada di depan atau di belakang atau di tengah)


      MsgBox(NewString)
      'hasilnya jika data awal : %%12%%. maka hasil : %%12
      MsgBox(NewString2)
      'hasilnya jika data awal : %%12%%. maka hasil : 12%%
      MsgBox(NewString3)
      'hasilnya jika data awal : %%12%%. maka hasil : 12
       
      =========================================================
      Logged

      «Reply #13 on: April 24, 2009, 09:30:51 PM »

      kiddo7th

      • SD Senior
      • *
      • Reputation Power: 4
      • kiddo7th belum punya pengaruh.
      • Offline Offline
      • Posts: 201

      • Aktivitas bulan ini
        0%
      • Lokasi: Langit Sebagai Atap Rumahku
      • Orang Gila ajah masih lebih care
      Re: VB.Net
      « Reply #13 on: April 24, 2009, 09:30:51 PM »
      Chapter 3. ASP
       
      Salah keunggulan .net adalah kita dapat membangun website dengan menggunakan .Net ini yakni melalui asp.
       
      Berikut ini adalah beberapa hal yang menyangkut asp
       
      ================================================================================================
      Import Somethink at ASPX or HTML - Mengimport sesuatu / komponen dalam page browser
      ================================================================================================

      <%@ Import NameSpace="something1" %>
      <%@ Import NameSpace="something2" %>
      <%@ Import NameSpace="something3" %>
      <%@ Import NameSpace="something4" %>

      ================================================================================================
      Logged

      «Reply #14 on: April 24, 2009, 09:32:20 PM »

      kiddo7th

      • SD Senior
      • *
      • Reputation Power: 4
      • kiddo7th belum punya pengaruh.
      • Offline Offline
      • Posts: 201

      • Aktivitas bulan ini
        0%
      • Lokasi: Langit Sebagai Atap Rumahku
      • Orang Gila ajah masih lebih care
      Re: VB.Net
      « Reply #14 on: April 24, 2009, 09:32:20 PM »
      =========================================================
      Link / Hyperlink / Other Connection - Koneksi antar halaman website
      =========================================================

      Response.Redirect("another_page .aspx/ .html / dll")

      <form ... ... action = "another_page .aspx/ .html / dll">

      <href = "another_page .aspx/ .html / dll">


      =========================================================
      Logged

      Pages: [1] 2
      « previous next »
       

      Page created in 0.194 seconds with 44 queries.