Pages

Wednesday, June 30, 2010

Menghitung Jumlah Total Nominal Pada DataGridView

Fungsi berikut untuk menghitung Total_Belanja pada DataGridView:

Private Sub Hitung()
   Dim totalbelanja As Long
   totalbelanja = 0
   For t As Integer = 0 To DataGridView1.Rows.Count - 1
      totalbelanja = totalbelanja + Val(DataGridView1.Rows(t).Cells(index).Value)
   Next
   Label1.Text = totalbelanja
End Sub

Mengubah Ukuran Kertas dan Orientasi Laporan Pada Crystal Report

Seringkali kita ingin mendesain laporan dengan orientasi landscape atau ukuran kertas tertentu. Berikut ini adalah langkah-langkahnya. Pada jendela Visual Basic 2008 pilih menu Crystal Reports kemudian pilih Design lalu Printer Setup. Pada kotak dialog Print Setup pilih Orientation lalu ubah menjadi Portrait/Landscape kemudian OK. Pada kotak dialog Print Setup pilih Paper kemudian ubah ukuran kertas lalu OK.

Window Visual Basic 2008

Kotak Dialog Print Setup

Tuesday, June 29, 2010

Navigasi Record Pada VB 2008

Navigasi record adalah berpindah antara record satu ke record yang lainnya (bisa next, previous, first, last). Kunci utama dari syntax navigasi record terletak pada row index. Misalkan kita membuat sebuah subroutine dengan nama NavigasiRecord() seperti di bawah ini:

Private Sub NavigasiRecord()
     txtFirstName.Text = ds.Tables("AddressBook").Rows(inc).Item(1)
     txtSurname.Text = ds.Tables("AddressBook").Rows(inc).Item(2)
End Sub

Syntax untuk navigasi menuju record selanjutnya adalah:

If inc <> MaxRows - 1 Then
     inc = inc + 1
     NavigasiRecord()
Else
     MsgBox("Tidak ada record.")
End If

Syntax untuk navigasi record sebelumnya adalah:


If inc > 0 Then
     inc = inc - 1
     NavigasiRecord()
ElseIf inc = -1 Then
     MsgBox("Tidak ada records.")
ElseIf inc = 0 Then
     MsgBox("Record pertama.")
End If


Syntax untuk navigasi record menuju record terakhir adalah:

If inc <> MaxRows - 1 Then
     inc = MaxRows - 1
     NavigasiRecord()
End If

Syntax untuk navigasi menuju record pertama adalah:

If inc <> 0 Then
     inc = 0
     NavigasiRecord()
End If

Sunday, June 27, 2010

Router Port Forwarding

This section was will show you how to forward ports you’ve just opened to your router. Since I don’t own every router in existence, I’ll show you what it takes for the LinksysWireless Broadband Router to have ports forwarded to it. The concept is the same for all routers and once you familiarize yourself with the steps, you should be able to navigate through your router settings with ease.

First you need to access your router. Open your web browser then type 192.168.1.1 in the address bar. A user name and password box should appear like the one below.


The factory password for this router is admin, leave the user name blank. Some routers may be admin as the user name with the password area blank. Check the documentation that came with your router or refer yourself to the company website to figure out what this is for your router.
NOTE: Highly recommend you changing that password from the factory setting ASAP if it still exists.

Once you type your password, the router settings should be displayed. Select Application & Gaming.


This screen is very easy to handle once you get familiar with it.


  • Application: Input a small abbreviation so you know what program you’re forwarding the ports for.
  • Start to End: A program will need a range of ports forwarded (i.e. 21000-21005). Under start, type the initial port and under end type the last port of the range.
  • Protocol: Select the one that the port utilizes.
  • IP Address: Type your computer IP address. Like was saying before; you complete this process and reboot your PC, the IP might change (Dynamic IP). Therefore, this setting would not be accurate and your ports will no longer be forwarded. Please use static IP Address in this case.
  • Enable: Self Explanatory.
Here is one good thing about the forwarding part. Let’s say you have a range of 10 consecutive ports to forwards (1100 – 1110). For the router settings you just type the start and finish but you’ll have to do each individual one and if the selection is both for all, you just doubled your work. No biggie, right?!

Save your settings and restart your system.

Ethernet Cable: Color-Code Standards

The information listed here is to assist Network Administrators in the color coding of Ethernet cables. Please be aware that modifying Ethernet cables improperly may cause loss of network connectivity.

Straight-Through Ethernet Cable


Crossover Ethernet Cable

Ethernet Cable Instructions:
  1. Pull the cable off the reel to the desired length and cut. If you are pulling cables through holes, its easier to attach the RJ-45 plugs after the cable is pulled. The total length of wire segments between a PC and a hub or between two PC's cannot exceed 100 Meters (328 feet) for 100BASE-TX and 300 Meters for 10BASE-T.
  2. Start on one end and strip the cable jacket off (about 1") using a stripper or a knife. Be extra careful not to nick the wires, otherwise you will need to start over.
  3. Spread, untwist the pairs, and arrange the wires in the order of the desired cable end. Flatten the end between your thumb and forefinger. Trim the ends of the wires so they are even with one another, leaving only 1/2" in wire length. If it is longer than 1/2" it will be out-of-spec and susceptible to crosstalk. Flatten and insure there are no spaces between wires.
  4. Hold the RJ-45 plug with the clip facing down or away from you. Push the wires firmly into the plug. Inspect each wire is flat even at the front of the plug. Check the order of the wires. Double check again. Check that the jacket is fitted right against the stop of the plug. Carefully hold the wire and firmly crimp the RJ-45 with the crimper.
  5. Check the color orientation, check that the crimped connection is not about to come apart, and check to see if the wires are flat against the front of the plug. If even one of these are incorrect, you will have to start over. Test the Ethernet cable.

Ethernet Cable Tips:
  • A straight-thru cable has identical ends.
  • A crossover cable has different ends.
  • A straight-thru is used as a patch cord in Ethernet connections.
  • A crossover is used to connect two Ethernet devices without a hub or for connecting two hubs.
  • A crossover has one end with the Orange set of wires switched with the Green set.
  • Odd numbered pins are always striped, even numbered pins are always solid colored.
  • Looking at the RJ-45 with the clip facing away from you, Brown is always on the right, and pin 1 is on the left.
  • No more than 1/2" of the Ethernet cable should be untwisted otherwise it will be susceptible to crosstalk.
  • Do not deform, do not bend, do not stretch, do not staple, do not run parallel with power cables, and do not run Ethernet cables near noise inducing components.

Saturday, June 26, 2010

Format Data Tanggal dan Waktu Pada SQL Server

SQL Server menggunakan format tanggal MM/dd/yyyy dan waktu hh:mm:ss seperti pada contoh perintah SQL berikut ini:

insert into test values ('888', 'Trisnadi Wijaya', '1:25:30 PM 12/30/2010')


Akan menghasilkan data seperti pada snapshot berikut:




Pada Kolom1 berisi 888, Kolom2 berisi Trisnadi Wijaya, dan Tanggal berisi 2010-12-30 13:25:30.000

Friday, June 25, 2010

Koneksi Visual Basic.Net ke MySQL

Untuk membuat kolaborasi antara VB.net dan MySQL diperlukan MySQL Connector (for .net tentunya) bisa di-download di MySQL Connector for .Net, dan jika sudah di-download silakan di-install.

Berikut adalah cara untuk menghubungkan antara VB.Net dengan MySQL:
1. Pilih menu Project lalu Add Reference kemudian cari MySql.Data lalu klik OK.


2. Pada bagian teratas dari halaman code form atau module ketikkan baris berikut: Imports MySql.Data.MySqlClient
Sekarang project VB.Net Anda telah terkoneksi dengan MySQL dan Anda dapat menggunakan code pemrograman seperti biasa untuk melakukan manipulasi pada database.
 

Blogger news

About Me

Palembang, Sumatera Selatan, Indonesia
Seorang yang ingin terus belajar.