Sabtu, 30 Oktober 2010

Belajar VB

BeLaJar VB Di Thread iNi oke..yg MAu beLaJar VB..diMari teMpatnya..

1. Pengertian VB

Code:
Microsoft Visual Basic (sering disingkat sebagai VB  saja) merupakan sebuah bahasa pemrograman yang

bersifat event driven dan menawarkan Integrated Development Environment (IDE) visual untuk membuat program aplikasi berbasis sistem operasi Microsoft Windows dengan menggunakan model pemrograman Common Object Model (COM). Visual Basic merupakan turunan bahasa BASIC dan menawarkan pengembangan aplikasi komputer berbasis grafik dengan cepat, akses ke basis data menggunakan Data Access Objects (DAO), Remote Data Objects (RDO), atau ActiveX Data Object (ADO), serta menawarkan pembuatan kontrol ActiveX dan objek ActiveX. Beberapa bahasa skrip seperti Visual Basic for Applications (VBA) dan Visual Basic Scripting Edition (VBScript), mirip seperti halnya Visual Basic, tetapi cara kerjanya yang berbeda.

Para programmer dapat membangun aplikasi dengan menggunakan komponen-komponen yang disediakan oleh Microsoft Visual Basic Program-program yang ditulis dengan Visual Basic juga dapat menggunakan Windows API, tapi membutuhkan deklarasi fungsi eksternal tambahan.

Dalam pemrograman untuk bisnis, Visual Basic memiliki pangsa pasar yang sangat luas. Dalam sebuah survey yang dilakukan pada tahun 2005, 62% pengembang perangkat lunak dilaporkan menggunakan berbagai bentuk Visual Basic, yang diikuti oleh C++, JavaScript, C#, dan Java.

2. OBject di VB
Code:
Fields and Properties

Fields and properties represent information stored in an object. You retrieve and set their values with assignment statements the same way you retrieve and set local variables in a procedure. The following example retrieves the Width property and sets the ForeColor property of a Label object.

Dim warningWidth As Integer = warningLabel.Width
warningLabel.ForeColor = System.Drawing.Color.Red

Note that a field is also called a member variable.

For more information, see Property Procedures vs. Fields.
Methods

A method is an action that an object can perform. For example, Add is a method of the ComboBox object that adds a new entry to a combo box.

The following example demonstrates the Start method of a Timer object.

Dim safetyTimer As New System.Windows.Forms.Timer
safetyTimer.Start()

Note that a method is simply a procedure that is exposed by an object.

For more information, see How to: Perform Actions with Methods.
Events

An event is an action recognized by an object, such as clicking the mouse or pressing a key, and for which you can write code to respond. Events can occur as a result of a user action or program code, or they can be caused by the system. Code that signals an event is said to raise the event, and code that responds to it is said to handle it.

You can also develop your own custom events to be raised by your objects and handled by other objects. For more information, see Events and Event Handlers.
Instance Members and Shared Members

When you create an object from a class, the result is an instance of that class. Members that are not declared with the Shared (Visual Basic) keyword are instance members, which belong strictly to that particular instance. An instance member in one instance is independent of the same member in another instance of the same class. An instance member variable, for example, can have different values in different instances.

Members declared with the Shared keyword are shared members, which belong to the class as a whole and not to any particular instance. A shared member exists only once, no matter how many instances of its class you create, or even if you create no instances. A shared member variable, for example, has only one value, which is available to all code that can access the class.
IntelliSense Listing of Members

IntelliSense lists members of a class when you invoke its List Members option, for example when you type a period (.) as a member-access operator. If you type the period following the name of a variable declared as an instance of that class, IntelliSense lists all the instance members and none of the shared members. If you type the period following the class name itself, IntelliSense lists all the shared members and none of the instance members. For more information, see Using IntelliSense.

Sumber : http://msdn.microsoft.com/en-us/library/...80%29.aspx

udah aH pembukanya..segitu aJa yah..
Lets sTart..


1. Coding Awal
ini gamBarnya..
http://upload.kapanlagi.com/h/2010022219...4c1b75.jpg

keterangan :
- warna Hitam: OBject Properties
disitu adaLah isian2 dari obJect yg kita punya..kita ngatur nama dari obJect,warna dari obJect,dan Lain2nya disitu..

- warna Merah : Project Explorer
disitu adalah tampilan dari Form2 yang telah kita buat..

- warna Biru : Toolbar
disitu adaLah tempat oBJect2 VB yg bisa kita gunakan..
tidak hanya itu obJectnya..kita bisa menambahkannya dengan menekan CTRL + T

- warna Kuning : Lembar kerja
disitu adaLah lembaran kerja kita..bisa kita tambahkan dengan obJect2 sesuai kita..untuk memberikan sebuah Coding..dengan cara menekan klik 2x pada oBJect yg ingin kita berikan coding..

sekian penJelasan mengenai gambar..

Masuk coding..

yg Perlu disiapkan :
- 1 Form
- 3 Text Box -> name : txtnil1,txtnil2,txtnilakhir [ klik di masing2 textbox liat di obJect properties ada bacaan name ]
- 4 command Button -> name : cmdtambah , cmdkali, cmdkurang, cmdbagi

oke..double klik di cmdtambah kasih coding ini :

Code:
txtnilakhir=val(txtnil1.text) + val(txtnil2.text)

penjelasan :
txtnilakhir : tempat akan ditampilkannya proses penjumlahan
val(txtnil1.text) dan val(txtnil2.text) : itu ada lah textbox yg ingin kita Jumlahkan..mengapa dikasih coding val..??karena,kita hanya ingin mengambil nilainya saja..[b]value[/b] kalau kita tidak memberikan val,maka dia akan menjumlahkan sebuah STRING..bukan angka yg dijumlahkan..

untuk yg cmdkali,cmdbagi dan cmdkurang..scriptnya sama saja..tinggal mengganti tanda (+) dengan tanda (*),(/) dan (-) tanpa tanda kurung..
penJelasannya sama..


sekian peLaJaran pertama..koreksi kaLo ada salah..


cpek nieh dah mlm..........besok mesti kul........
dadaaaaaaaaaaaaaaaaaa..................

Tidak ada komentar:

Posting Komentar