100 likes | 238 Vues
This guide provides an overview of Visual Basic .NET programming concepts, including program structure, compilation processes, and variable management. It covers key topics such as main procedures, variable scope, constants, and various compilation options in Visual Studio .NET. Learn about the importance of namespaces, classes, modules, and how to declare variables and constants efficiently. Gain insights on debugging and optimizing your applications with configuration options. Ideal for aspiring developers and IT trainers wanting to deepen their knowledge in VB.NET.
E N D
Visual Basic.NET-Basic Rully Yulian MF MCAD,MCPD,MCT,MVP VB.NET Independent IT Trainer - Application Developer http://www.yulianmf.com rully@yulianmf.com
Overview • Struktur Program Visual Basic.NET • Kompilasi • Main Procedure • Variable And Scope • Konstanta
Struktur Program Visual Basic • Option (Strict, Explicit, Infer, Compare) • Note : Option Infer hanya ada di VB 9.0 • Imports • Namespace - Class, Module, Structure, Interface • Class - Sub, Function, Property, Field, Event
Kompilasi • Compiler terpisah dengan IDE Visual Studio.NET • Auto Compiled dengan Visual Studio.NET • Manual Compilation dengan Vbc.exe (Visual Basic Compiler) • Vbc.exe terdapat di dalam .NET Framework SDK
Opsi Kompilasi • Build configurations • Debug – provides debug information • Release – optimizes code and executable size • Build options • Build – only builds changed projects • Rebuild – rebuilds project regardless of changes
Main Procedure • Entry Point • Sub Main, Function Main As Integer • Sub Main(ByVal args() As String) • Function Main (ByVal args() As String) As Integer • Aplikasi Console harus memiliki Main Procedure • Aplikasi Desktop (.exe) generate Main Procedure secara otomatis oleh compiler. • Class Library (.dll) tidak membutuhkan Main Procedure.
Variabel & Comment • Tempat penyimpanan data sementara di memori • Dideklarasikan dengan perintah Dim (Dimension) • Single Declaration : • Dim strNama As String • Multiple Declaration : • Dim intUmur, intJumlah As Integer • Dim intUmur As Integer, strNama As String • Komentar menggunakan tanda kutip tunggal : • ‘Komentar di Visual Basic tidak di proses sebagai code
Variable Scope • Namespace / Class Level Variable • Procedure Level Variable • Block Level Variable Namespace Module Procedure Block
Konstanta • Dideklarasikan dengan perintah Const : • Const dblRadius As Double = 2.34 • Nilai harus diinisialisasi pada saat deklarasi • Nilai tidak dapat diubah selama aplikasi berjalan • Menggunakan memori lebih sedikit dibandingkan dengan variabel