شرح لغة فيجوال بيسك دوت نت

781
ﻋﻤل ﺍﻁﺎﺭ ﺭﻤﺠﺔ.NET ﺒﺎﺴﺘﺨﺩﺍﻡVisual Basic .NET -- ﺍﻟﻌﺴﻴﺭﻱ ﺘﺭﻜﻲPDF created with pdfFactory Pro trial version www.pdffactory.com

Upload: tar3q

Post on 27-Jul-2015

1.860 views

Category:

Documents


4 download

TRANSCRIPT

. NET

Visual Basic .NET

--

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

)) ((

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

... ... ...

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

.NET Visual Basic .NET 3002- .NET Visual Basic .NET

. .

.... Microsoft(

- ) ADO .NET Visual Basic .NET

.

-

.

-

.

-

.

- : 6783 -

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

.................................................................. ..................................................................

............................................... 6Visual Basic 1 ..................... .......................................

.................................................................

.............................................................

................................

................................... CD-ROM ) ( ............................................. .................................................... : ............................................................. 1 : 3 .............................. Visual Basic .NET ...................................

3 ....................................................... .NET 4 ....................................... Windows 4 .......................................... DOS

7 ................................. COM

............................................... 8 10 ..................................................... .NET .NET 11 ............................ COM ......................................... 31 ........................... 31 .................................... 41 .............................. 01

................................ 11

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

16 ...................................... JIT 17 ..................................... Assemblies

15 .......................... .NET Framework

............................................ 81 ................................................ 42 .............................................. 62

17 ................................. Visual Studio .NET

.................................................. 62 ............................................... 82 ............................................ 62

.......................................... 03 31 .................................. ArabicConsole

: ..................................................... 53 35 ......................................... Modules )(38 ....................................... Sub Main )(39 ........................................ Sub New

............................................. 23

.................................................... 14 ................................ 34 ...................................... 14

................................................. 84 ....................................................... 85 59 ................................... Enum

.................................................... 25 ................................................ 95

62 ............................... Structure

................................................... 76

.................................................... 96 .................................... 07

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

73 ......................... Windows API ....................................................... 47 74 ............................... If Then 77 .............................. Select Case ............................................ 97 ...................................................... 18 .......................... 48 .......................................... 28

................................ 27

85 ..................... Imports 87 ................ Imports : ................................................ 98 ................................................. 98 .................................................... 49

94 .............................................. Fields 105 .................................... Properties 110 ............................................ Event ........................................ 611 96 ........................................... Methods

..................................................... 611 .................................... 911 ................................................... 321 ............................. 731 ........................................ 621 ................................................... 831

138 ......................... Shared Fields 140 ...................... Shared Methods 142 ....................... Shared Events 141 ................ Shared Properties

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: ........................................................ 741 .................................................... 741 149 ................. Visual Basic .NET ................................................. 741

.................................. 251 154 .................................. Constructors ............................................. 251

159 ........................................... Overriding ............................. 161 166 ......................................... MyBase 168 ........................................ MyClass 169 ...................................... Shadowing 173 .................. Shared Members 174 ........................ NotInheritable 174 ............................ MustInherit .................................................... 771 176 ......................... MustOverride

......................................... 751

.............................................. 471

...................... 481

................................ 181

......................................... 771

: ......................... 781 ............................................................ 781 ................................................. 091 ....................................... 691 ............................................. 291

198 ...................... .NET Framework

............................................ 791

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

199 ................................... IComparable 201 ...................................... ICloneable IEnumerable 203 .............. IEnumerator ........................................ 802 ............................................................. 702

............................................. 112 ............................................. 212

StructLayout 223 ...... FieldOffset

221 .......................... Obsolete Attribute

221 ........ DebuggerStepThrough Attribute

218 ....................... Conditional Attribute

218 ..................... .NET Framework

217 ........ Visual Basic .NET

.......................................................... 712

............................................. 412

....................................... 522 : 229 .............................. .NET Framework : ............................................. 132 231 .............................................. System.Object .......... 432 232 ........................................ Object

....................................................... 632 ............................................. 242 ......................................... 932

........................................ 632

243 ........................................ CultureInfo ......................................... 642 247 ..................................... Char

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

........................................................ 052 .............................................. 252 255 ............. Random Numbers ....................................... 652 254 ................................................ Math ........................................ 152

248 .......................... StringBuilder

.......................................................... 652

ICollection 270 .......................... IList

270 ............................... System.Collections

265 .................................... Array

263 ................................... Enum

271 ................................................ Stack 272 ............................................... Queue

273 ........................................... ArrayList

: .............................................. 572 ........................................................... 572 ....................................... 572 .................................................... 872 .......................................... 672

279 .................................................. Exception 280 ............... Catching Exceptions 287 ..... Custom Exceptions 284 .............. Throwing Exceptions

.......................................... 882 ........................................... 092 Exception 290 ........................... Err

288 .......................................................... Err

292 ........................... Visual Studio .NET

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

................................................. 492 : ............................................ 992 ........................................ 103 299 .................................................... Directory 296 .............................. Configurations

............................................... 292

.................................. 213

.................................. 903

............................... 603

305 ....................................................... Stream

303 ........................................................... File

............................... 203

Custom Streams ......................... 413 .......................................................... 613 DirectoryInfo 317 ...................... FileInfo 316 .................................................. Path

: 321 ................. Object Serialization .......................................... 223 323 ......... Binary Serialization ............................................. 223

............................................... 132 336 .................................... ISerializable

228 .......................... Object Graph

) ( ................ 523

Custom Serialization ............................. 533 ................................................ 733

........................................... 143

340 ..................................... XmlSerializer

338 .............................................. XML

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 349 ............................... Threading ............................................ 943 ....................... 153 ....................................... 053

.............................. 543

........................................ 453

............................................ 353

372 ................................ TLS

370 ..................... ThreadStatic Attribute

............................... 963

..................................................... 863

.................................. 463

........................... 473 377 .............................. Thread Synchronization 379 ............................. Synchronization 380 .................................. MethodImpl ................................................. 183 377 ............... SyncLock End SyncLock

383 ................................................. ThreadPool 386 ................................................... Timers 387 ........................ System.Timers.Timer 388 .................... System.Threading.Timer

: 391 .............................. Assemblies 391 ............................ Managed Modules 392 ............................................ Assemblies ..................................... 493

....................... 393

397 ........................... Strong Names

.............................. 593

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

398 ............................... Configuration Files ............................................ 004 ......................................... 993

397 ..................................... Assembly

403 .... .NET Framework Configuration

...................................... 004

406 ...................................... VBC.EXE 408 .......................................... AL.EXE 412 ......................................... SN.EXE

.................................... 504

: 415 ................. Reflection Classes ............................. 514 416 ........................................... Assembly 418 ............................................. Module

413 ............................... GACUTIL.EXE

............................................ 914 419 ....................................... System.Type ........................................... 124

................................................. 224 422 .............................. MemberInfo ...................................... 624 .......................................... 524

......................................... 924

.......................................... 824

.................................................. 134 431 ............................... ReflectionExample / ...................................... 234

430 ............................................ Parameters

/ .................................. 334

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

............................................. 334 ................................... 534 ................................ 634

...................................................... 534

: 439 ................................... Windows : 441 ............................ Windows Forms 442 .............................. Windows Forms .................................. 544 Form ............................. 944 ................................. 844 ...................................... 054 442 .......................... Form Designer

.......................................... 054 ............................................. 654

.............................................. 354

466 ............................ Popup-Menu ................................... 964

.............................. 564

463 ...................................................... Menus

................................... 264

461 .......................... Child Windows

460 ............................................... MDI Forms

MDI .................................... 664 ...................................................... 964

: 479 .................................... Controls

............................................. 474

470 ........................ Form Inheritance

469 .............................. Modeless

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

480 .......................................... Name

................................................. 974 ........................................... 084

........................................ 784 ........................................... 884 ........................................... 984 ............................................ 094 ........................................... 984

.................................... 284

..................................................... 094 ................................................... 194 ........................................ 394 ................................................ 294

.............................................. 494 ............................................... 494

............................................... 594 497 ............................................... Label 498 ........................................... TextBox 501 .............................................. Button 501 ......................................... CheckBox 502 ............................................ ListBox 502 ...................................... RadioButton 504 ................................. CheckedListBox 505 ........................................ ComboBox 497 ......................................... LinkLabel

505 ......................................... ImageList 506 .......................................... TreeView ToolBar 509 .......................... StatusBar 508 ........................................... ListView

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

510 .............................................. Splitter .............................. 015 ............................................... 515 ............................................ 415

.............................................. 725 ............................................ 825

522 ............. Visual Basic .NET

..................................... 125

520 ........................... RightToLeft

518 ................................... RightToLeft

.......................................................... 815

.............................. 725

: +531 ........................................ GDI 532 .......................................... Graphics ....................... 335 ...................................... 435 ........................................................ 135

540 ....................................... Brush

...................................................... 735

538 ......................... GraphicsPath

535 ............................................. Pen

................................................... 545 .............................................. 645 ....................................... 545

............................................... 245

............................................... 255 ................................................... 455 552 ............................................. Icons

................................ 945

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

............................................. 655

............................................. 455

................................................ 755 567 ....................................... Controls 558 ..................................... StringFormat

................................................. 175 ................................ 875 ......................................... 285 587 .............................. Windows ............................................ 185 ................................................... 275

: ....................................... 175

587 .......................................... Windows

588 .............. Windows Service

............................................. 095 .............................................. 395 592 ................ System.IO.FileSystemWatcher

599 ............................................... Cursor Registry 601 ....................... RegistryKey 603 ................................................. Help 600 .......................................... SendKeys

598 ........................................ Application

.......................................................... 895

596 .................................. InstallUtil.EXE

.............................................. 595

608 ............................................ ADO.NET

: ........................................... 506 : 607 ................................. ADO.NET

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

609 ........................ .NET Data Providers

.......................... 806

611 ......................................... ADO.NET .......................................... 216

612 ........................................ Connection

............................................... 316

........................................... 816

617 .......................................... Command ........................................... 816

..................................... 416

626 .......... Microsoft SQL Server : ADO.NET ......................... 926 .......................................... 726

............................................. 426

.......................................... 326

623 ........................................ DataReader

............................................. 126

620 ................................. SQL

629 ............................................. DataSet 633 ........................................... DataRow 634 ...................................... DataRelation 638 ....................................... DataAdapter ................................... 836 639 ......................... DataAdapter ........................................... 046 DataSet .................... 536 634 ....................................... DataColumn 632 .......................................... DataTable

............................................... 146

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

............................................. 446

648 ............. xxxCommand ................................................. 946 651 .................................... RowUpdated ......................................... 056

......................................................... 356 ............................................. 556 ................................................. 456

: 653 ...................... XML

659 .............................. ADO.NET 660 ........................ Complex Binding

......................................... 656

662 .............................................. XML 664 ................................... XmlTextWriter 663 ................................... XmlTextReader

666 ............................... XML

ADO.NET 665 ...................................... XML

668 ............................... XML : ..................................................... 966 : 671 ................................. (1) ASP.NET 671 ........................................................... IIS 672 .......................................... IIS ................................. 576 ............................................... 376

............................................. 876 .............................................. 286 .................................... 186

677 .................................... Web Forms

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

....................................... 886

............................................... 586

................................................... 096

................................... 096 ...................................... 396

690 .......................................................... Page

....................................... 396

: 701 ....................... (2) ASP.NET ASP.NET .............................. 107 701 ..................................... HttpRequest 705 ............................... HttpServerUtility 703 .................................... HttpResponse

697 ................................ Validation

696 ....................... HTML Forms Controls

695 .......................... Web Forms Controls

............................................................ 596

............................................... 496

707 ............................................... Global.asax )( xxxStart )(707 ..................... xxxEnd )(708 ................................. Global_Error ..................................... 907

706 ................................ HttpSessionState

705 .......................... HttpApplicationState

709 .................................................... Security 708 .......................... ASP.NET Forms ................................... 907 714 ............................. Login >713 .................................... -1 Visual Basic

.Visual Basic

6Visual Basic 1

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

.Microsoft Microsoft .NET Visual C# .NET Visual Basic . Microsoft Visual C# .NET

- .

: # C

BASIC - if Then Visual Basic .NET Visual C# .NET ";" .

) Microsoft Visual Basic .NET Visual Basic

(.

6>-1 Visual Basic .NET .Visual Basic

- - Visual Basic Microsoft Visual Basic ..NET

.

Help

- "" ""

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

.Windows Overloading " " .

" "

.NET Documentation .

.NET Framework MSDN . .Microsoft -

Visual Basic .NET

007 :

Objects Inheritance .NET Framework . OOP Classes .Polymorphism

:

.NET Framework Exceptions File IO Object

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

Serialization Threading Assemblies Windows Application Windows

.Reflection Classes

Forms Controls + GDI . Mirroring.

Custom Controls Windows ADO.NET Connected

.Services

Mode Disconnected Mode ASP.NET ASP.NET ADO.NET .XML

ASP.NET Web Services

.

) (JPG ArabicConsole.DLL Console - .Visual Basic .NET .

.

CD-ROM

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

. :

http://www.dev4arabs.com/lib/vbnetbook

) (

. ) ( .

.

. . -

.Visual Basic .NET

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

Source Codes .

- .NET Visual Basic .NET .NET Documentation.

.NET Framework

.

Visual Basic .NET ... ! --

3002 [email protected]

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

1

Visual Basic .NET 11 Visual Basic ..NET Framework ) Visual Basic for .NET Framework Visual Basic Visual Basic .NET .(.NET Framework Visual Basic .NET 41

. .NET - .NET

.Framework ..NET

.NET . DOS Microsoft .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

4 :

DOS -- Input Print .

.

...(

- - Devices ) .Drivers Assembly . - - .

. . 321 Lotus -MS

DOS 002 . ) ( .

Windows

Windows

-

- .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: Visual Basic .NET 5

Messages Click ... KeyDown. .

Windows DOS

- - Print

Windows

. Hello World Windows :

)(! C

>#include Other Windows->Object Browser ) 1 -9

:Object Browser

Reference (.

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: Visual Basic .NET 32

1 -9: . :Code Editor

) 1 -01 ( IntelliSense "." "+" .

.

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

42 :

1 -01: . ) ....(

Text Editor ) Option 1 -4 91(.

. :File . Printing . :Edit

Copy Cut Paste .Bookmarks

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: Visual Basic .NET 52

:View . :Project

Reference . Set As Startup Project Project .Solution

Configuration

Compiling Manager .

:Build

9

:Debug

31 ) ( Debugging. .

.Externals Tools -Add Ins .Add-In Manager

:Tools

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

62 :

:Window ! :Help

MSDN .NET Documentation . Dynamic Help

. .

Toolbars Customize .Microsoft Office

Visual Basic .NET Visual Studio .NET .

Solution Projects

Solution Blank Project Files .Project Items

Solution New File New

Project . OK

Visual Studio .NET - - .sln .suo sln suo

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: Visual Basic .NET 72

.

Project New File

Node Visual Basic Projects

Templates .

Add to solution ) OK 1 -11(:

1 -11: Templates . Visual Basic .NET .vb

) Solution Explorer 1 -6 72(.

) UserControls Windows Forms ... Classes( .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

82 :

Controls Windows Application Class Library New Projects : Visual Basic .NET User

Windows ) .(Standard Application Windows . :Class Library

:Windows Application

.DLL :Windows Control Library

.Windows Application

User Controls .

ASP .NET Server Clients .Browsers ASP .NET . :ASP .NET Web Service

:ASP .NET Web Application

HTTP XML DCOM .Web Services

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: Visual Basic .NET 92

:Web Control Library HTML User Controls .Browser

DOS .

:Console Application

.Visual Basic .NET

Windows Background . .

:Windows Services

. :Empty Web Project .

:Empty Project

Templates Windows Service Windows Application User Control .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

03 :

Visual Basic .NET Notepad - .Console Application

Visual Basic .NET .

Console Application

:

1Module Module )(Sub Main End Sub End Module

1 Module FirstProg Console . :

Module FirstProg )(Sub MainConsole.WriteLine("In the name of Allah the most gracious )"and the most merciful

End Sub End Module

]5 [F Start Debug )

Compiling (

] [ENTER :

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: Visual Basic .NET 13

Module FirstProg )(Sub Main

)(Console.Read End Sub End Module

) 1 -21(.

1 -21: .

ArabicConsole

Console

ArabicConsole Console . ArabicConsole ) 1 -7( )( WriteLine . Brows ArabicConsole.DLL .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

23 :

ArabicConsole

:

' ' ArabicConsole Imports ArabicConsoleProject Module FirstProg )(Sub Main ArabicConsole.WriteLine End Sub End Module

)" "(

Imports ArabicConsoleProject .

)( Read

ArabicConsole .

Compiling - - Compiler Visual Studio .NET Debug

.Configurations ) Visual Studio .NET 1 -31(:

1 -31: .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: Visual Basic .NET 33

Release . Configuration Properties .NET .Project Property Pages

Framework microsoft.com

001 .

.Visual Basic .NET Visual Basic .NET .

.NET Visual Studio .NET

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

2

.Windows

Visual Basic .NET

Visual Basic .NET Windows Forms

Windows Applications Web Windows ArabicConsole

Applications ... Windows Services Visual Basic .NET .

Visual Basic .NET . - )

...( .Visual Basic .NET

Module

Modules

FirstProg :Module

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

63 : Module FirstProg )(Sub Main )" "(ArabicConsole.WriteLine End Sub End Module

) Module X

.(End Module

:Statement is not valid in a namespace ' ' Module Dim X As Integer )( Sub Test End Sub Module FirstProg End Module

-

:

Module DrawingFunctions End Module Module InternetFunctions End Module Module SystemFunctions End Module

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 73

Identifiers ) ...( :

38361 -

"_"

!

.( As Integer ] [

] [ ) : ]Dim [Dim

Keyword .

"_" ) (.

.

Visual Basic .NET UNICODE : As New Dim As Integer Dim = 23 Then. If 0 = 2. = End If ) ,02( ._.

Module

:

' MyModule '

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

83 : ' First.vb Module MyModule End Module ' Second.vb Module MyModule End Module

Namespaces. .

)(Sub Main Module )( Main :

1Module Module )(Sub Main A )" "( rabicConsole.WriteLine End Sub End Module

)( Main :1Module Module )(Sub Main )" "(ArabicConsole.WriteLine End Sub End Module

2Module Module )(Sub Main

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 93 )" "(ArabicConsole.WriteLine End Sub End Module

)( Main ) Property Pages 2 -1(. Module )( Main Sub Main . ) ( )( Main Startup Object Project

2 -1: .

)(Sub New Constructor . )(New New

)(:Main

1Module Module )(Sub New

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

04 : )" New"(ArabicConsole.WriteLine End Sub )(Sub Main )" ArabicConsole.WriteLine("Main End Sub End Module

Constructors .

2 Module :

1Module Module )(Sub New )" New"(ArabicConsole.WriteLine End Sub )(Sub Main )" ArabicConsole.WriteLine("Main End Sub End Module 2Module Module )(Sub New )" "(ArabicConsole.WriteLine End Sub End Module

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 14

. Visual Basic .NET

.

Dim As

:

' Integer Dim Age As Integer ' String Dim FirstName As String Dim LastName As String

String Visual Basic .NET :

Dim Age As Integer Dim FirstName, LastName As String

: ' ' Dim FirstName, LastName As String, Age As Integer

Object :

Dim X 01 = X "01" = X ' Integer ' String

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

24 :

. :Option Explicit

Option Explicit Off :Dim

Option Explicit Off 1Module Module )(Sub Main ' ' Dim " " = programmerName ) ArabicConsole.Writeline ( programmerName End Sub End Module

:

' ' ) ArabicConsole.Writeline ( programerName

Option Explicit Off Object Option Explicit Off .

.

Off Option Explicit Build

) Project Property Pages 2 -2 (.

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 34

2 -2: Option Explicit On .Off

Visibility Scope X )(1 MySub :

)( 1Sub MySub Dim X As Integer 02 = X End Sub )( 2Sub MySub X ' )ArabicConsole.WriteLine (X End Sub

Lifetime

X 02 )(1 .MySub Visual Basic .NET :

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

44 :

: Dynamic Local Variables . . Dim .

Microsoft .NET smallCase

small .Capital:

Dim programmerName As String Dim userID as Integer Dim employeeSalary As Decimal

Block level Variables ) Block For Next If Then Do Loop(. . y :For Next

Dim counter As Integer 01 For counter = 1 To Dim y as integer Next

- :

Dim x As Integer If x = 0 Then Dim y As Integer End If x = y '

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 54

:

Dim a As Integer Do Dim a as integer Loop '

Visual Basic .NET

:

' Dim x As Integer If x = 0 Then Dim x As String End If Do Dim x As Long Loop ' '

x

2 For counter :

Dim counter As Integer Dim counter2 As Integer 3 For counter = 1 To 3 For counter2 = 1 To ' Dim x As Integer 1 + x = x )ArabicConsole.WriteLine(x Next Next

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

64 :

:1 2 3 4 5 6 7 8 9

: Static Local Variables Static Dim :

) (

Static staticVariable As Integer

.

:

)( Sub Counter Static counter As Integer 1 + counter = counter End Sub )( Sub PrintData Static isPrinting As Boolean If isPrinting Then Exit Sub Else isPrinting = True End If End Sub

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 74

Static

. :

Visual Basic .NET Module Level Variables . :

Private Dim

1Module Module ' Dim x As Integer Private y As Integer )(Sub Main 05 = x End Sub )( Sub Test 01 = y End Sub End Module

. Public :

Global Variables

1Module Module Public x As Integer )(Sub Main 5 = x End Sub End Module

'

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

84 : ' 2Module Module )(Sub Test 1 = x End Sub End Module

'

Friend Public . Friend .

.NET PascalCase

smallCase : ' '

Public ProgrammerName As String Friend ClientAge As Integer Dim programmerName As String Private clientAge As Integer

.

) .... Date Long Integer String( - :

Visual Basic .NET Classes Structures ( : Object

) BCL .NET Framework

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 94

. Byte . ) Visual Basic .NET - (

.

Primitive Data Types :Visual Basic .NET 2 1 8 2 Boolean Byte Char Date

) True( ) False(. .UNICODE 0 552.

00:00:0 95:95:11 9999.

1 1000 13 0 0

533,059,345,395,733,462,415,261,822,97 5330593453957334624152618229.7

61

Decimal

803+ 1.79769313486231570E .

423- 4.94065645841246544E 423- 4.94065645841246544E

8

Double

803+ 1.79769313486231570E 846,384,741,2 . 4 Integer

746,384,741,2.

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

05 :

- 808,577,458,630,273,322,9 708,577,458,630,273,322,9. .

4 8 4 2 4

Long Object Short Single

54892104.1 . -E .

83+ 3.4028235E -E

867,23 767,23.

54892104.1 83+ 3.4028235E 01 + )2 * ( String

0 2 .UNICODE

Char .String Unicode

Char " "c Char :String

Dim A As Char "c" = A "c" = A '

Char

String

. Char

Value Type Variables String .Reference Type Variables .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 15

: - - Visual Basic .NET Object

Basic .NET : Value Type Variables

. - Visual Reference Type Variables .Value Type Variables

) System.ValueType

(. ) Stack ( .

Numbers Char Boolean Date Reference Type Structures Enums .Value Type

) Pointer ( Garbage Collection .NET : ' '

Managed Heap

" " = Dim Name As String 99 = Dim Age As Integer

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

25 :

2 -3: . .

String Arrays

Classes .Reference Type

.

.

"="

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 35 01 = Dim X As Integer Dim Y As Integer Dim Z As Long 02 = Y 03 = Z '

:

' 03 = Dim X As Integer, Y As Integer = 20, Z As Long ' 03 = Dim X, Y As Integer = 20, Z As Long

: ' 652 = Dim X As Byte

Visual Basic .NET

:

5 + 5 = Dim X As Integer X X X X X =+ =- =* =\ =^ 1 2 3 6 2 ' ' ' ' ' x x x x x = = = = = x x x x x + * \ ^ 1 2 3 6 2

: Visual Basic .NET ' ' 01 =+ Dim X As Integer 02 =^ Dim Y As Long

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

45 :

Value Type .Reference Type

) Managed

.(Heap ) 2 -4(:

' " " = Dim Name As String Dim Name2 As String = Name ' 99 = Dim Age As Integer Dim Age2 As Integer = Age

2 -4: . ) 2 -4( ) Name 2 (Name

Managed Heap

) Age 2 (Age .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 55

) (Stack 4 .

. ( ) (Double :

:Option Strict

Widening Conversion )Short

9999.3 = Dim A As Single Dim B As Double = A )ArabicConsole.WriteLine(A )ArabicConsole.WriteLine(B 9999.3 ' 9999.3 '

Double

Single

Double :Single

9999999.3 = Dim A As Double Dim B As Single = A )ArabicConsole.WriteLine(A )ArabicConsole.WriteLine(B 9999999.3 ' 4 '

Visual Basic .NET Single .Double Narrowing .(Single : Long Integer Short ... Byte.

Conversion ) (Double )

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

65 :

Option Strict On Visual Basic .NET Option Strict On:

) (Bugs

' Option Strict On 1Module Module )(Sub Main 1 = Dim A As Double Dim B As Single A = B B = A End Sub End Module ' '

Option Strict - - - Project Property Pages ) Option Explicit 2-2 34(.

Option Strict

... Boolean Date String:

' Option Strict Off ' Dim A As String Dim B As Boolean "A = "True B = A

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 75

\

/ ^ :Double ' ' Option Strict On Dim X As Integer 2 / 01 = X 3 ^ 2 = X

Option Strict On

:

' ' Option Strict On 2.3 = Dim X As Double )Dim Y As Integer = CInt(X

: Boolean Byte Char Date Double Decimal Integer Long Object Short Single String CBool CByte CChar CDate CDbl CDec CInt CLng CObj CShort CSng CStr

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

85 :

Option Strict On

Value Type -Reference Type .

Integer :Double

)01( ArabicConole.WriteLine )5.5( ArabicConole.WriteLine

' Integer ' Double

" "L

Long " "S Short " "D Decimal " "F Single

) :(MSDN

Dim X As Long Dim Y As Long 001 = X Y = 100L

'

Date / # #:Dim X As Date Dim Y As Date #3002/92/1# = x #Y = #2/15/2003 9:30:00 PM

) EXE(. Const :

" " = Const PROGRAMMER_NAME ' )ArabicConsole.WriteLine(PROGRAMMER_NAME

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 95

Option

:Strict On

" " = Const PROGRAMMER_NAME As String

Hexadecimal

Octal &H &O - :552 '

' )ArabicConsole.WriteLine(&HFF ' )01ArabicConsole.WriteLine(&O

8 '

- Integer " "L :1- ' 5927694924 '

)ArabicConsole.WriteLine(&HFFFFFFFF )ArabicConsole.WriteLine(&HFFFFFFFFL

Hexadecimal Octal

:

' )52.ArabicConsole.WriteLine(&HFF

Visual Basic .NET. Enums Structures .

Enums .Enumeration Enum

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

06 :

Module

.Structure :

Enum Day Saturday Sunday Monday Tuesday Wednesday Thursday Friday End Enum

:Dim x As Day Dim y As Day x = Day.Friday y = x

Enums - - .

Enums :)Sub ShowDay(ByVal CurrentDay As Day If CurrentDay = Day.Friday Then )""(ArabicConsole.WriteLine End If End Sub

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 16 Dim X As Day X = Day.Friday )ShowDay(X )ShowDay(Day.Friday

0 :Enum Day 01 = Saturday 02 = Sunday Monday Tuesday Wednesday Thursday Friday End Enum

. Monday 12 Integer

Tuesday 22 ... .

Visual Basic .NET Short Byte Long .NET

:

Enum Day As Long Saturday Sunday End Enum

:

Private

Public

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

26 : 1Module Module ' Enum GlobalEnum 1Enum 2Enum End Enum ' 2Public Enum GlobalEnum 1Enum 2Enum End Enum ' Private Enum PrivateEnum 1Enum 2Enum End Enum End Module

Enum Private . Enum Structure .Modules

Friend

Public .

User Defined Types ) (UDT . Structure :

Structures

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 63 Structure Person Dim Name As String Dim Age As Integer End Structure

: Dim Turki As Person Turki.Name = "" Turki.Age = 99 ArabicConsole.WriteLine(Turki.Name) ' ArabicConsole.WriteLine(Turki.Age) ' 99

:

Dim Turki2 As Person Turki2 = Turki ArabicConsole.WriteLine(Turki2.Name) ' ArabicConsole.WriteLine(Turki2.Age) ' 99

- Nested Structure

:

Structure Person Structure AddressStruct Dim City As String Dim Countrey As String End Structure Dim Name As String Dim Age As Integer Dim Address As AddressStruct End Structure

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

46 : Dim Turki As Person " " = Turki.Name 99 = Turki.Age "" = Turki.Address.City " " = Turki.Address.Countrey

Structure Visual

Basic .NET ) ++ (C

Methods

:Properties

Structure Person Dim Name As String Dim Age As Integer ' )(Sub ShowData )ArabicConsole.WriteLine(Name )ArabicConsole.WriteLine(Age End Sub End Structure

:Dim Turki As Person " " = Turki.Name 99 = Turki.Age )(Turki.ShowData

.

)

( Constructers .Structures ! !

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 56

.

)( Sub New .

:

Structure MyStruct 0 = Dim x As Integer 01 = Dim y As Integer End Structure

) ( )( Sub New )0 Nothing(.

)( Sub New ) Overloading (. Parameters )(:Sub New

Structure Person Dim Name As String Dim Age As Integer ' Overload )Sub New(ByVal PersonName As String Name = PersonName )" "(ArabicConsole.WriteLine End Sub End Structure

)( Sub New :

' Dim Turki As Person

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

66 :

)( Sub New ) ( . New :

Visual Basic .NET

' )" "(Dim Turki As New Person

.

Dim . Private :

Structure Person Public Name As String Dim Age As Integer Private MotherName As String )(Sub Test " !" = MotherName End Sub End Structure

Public Dim '

' '

Public Private Access .Specifiers Friend Public ) (.

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 76

! Structure

.Enums Private :

) Public ( Friend.

.

Visual Basic .NET 23 :

Dim OneDim (9) As Integer Dim TwoDims (1, 1) As String

01 ' 2 * 2 = 4 '

- 0:

001 = )0( OneDim 002 = )1( OneDim 009 = )9( OneDim TwoDims TwoDims TwoDims TwoDims ,0( ,0( ,1( ,1( )0 )1 )0 )1 = = = = "" "" "" ""

:

}9 ,8 ,7 ,6 ,5 ,4 ,3 ,2 ,1{ = Dim OneDim() As Integer }}"" ,""{ ,}"" ,""{{ = Dim TwoDims(,) As String

Dynamics Arrays

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

86 :

ReDim ReDim :

)99( ReDim OneDim )01 ,01( ReDim TwoDims 0 ' ) )0(ArabicConsole.WriteLine ( OneDim

Preserve - : ' )005( ReDim Preserve OneDim )005 ,01( ReDim Preserve TwoDims ' )005 ,005( ReDim Preserve TwoDims

' )005 ,005( ReDim Preserve OneDim )001( ReDim TwoDims

Preserve :

:Erase

Erase OneDim Erase TwoDims

Reference Type

"=". )(:Clone

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 96 } ,3 ,2 ,1{ = Dim X () As Integer Dim Y () As Integer X ' Y )(Y = X.Clone

)( UBound

)( LBound :

)For counter = LBound(OneDim) To UBound(OneDim Next

:)UBound(OneDim )1 ,UBound(OneDim )2 ,UBound(OneDim ' ' '

Visual Basic .NET Sub Function : ' )(Sub MySub )" "( ArabicConsole.WriteLine End Sub ' ' Long Function Abs (ByVal X As Integer) As Long If X < 0 Then Return -X Else Return X End If End Function

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

07 :

Parameters :

' )( MySub 5 ' ))5-( ArabicConsole.WriteLine (Abs

Exit Sub

Sub Exit Function :Function

Function Abs (ByVal X As Integer) As Long If X = 0 Then Exit Function End If End Function

Exit Function 0 Nothing .

Private Friend Public.

:ByRef

' )Sub swapByVal(ByVal a As Integer, ByVal b As Integer Dim temp As Integer temp = a a = b b = temp End Sub

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 17 ' )Sub swapByRef(ByRef a As Integer, ByRef b As Integer Dim temp As Integer temp = a a = b b = temp End Sub

:Dim A As Integer Dim B As Integer 01 = A 02 = B ' )swapByVal (A, B 01 ' )ArabicConsole.WriteLine (A 02 ' )ArabicConsole.WriteLine (B ' )swapByRef (A, B 02 ' )ArabicConsole.WriteLine (A 01 ' )ArabicConsole.WriteLine (B

. . - . Reference Type Variables .ByVal

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

27 :

Visual Basic .NET Optional .ParamArray :

Optional

:

)1- = Sub MySub(Optional ByVal X As Integer If X = -1 Then )" "( ArabicConsole.WriteLine End If End Sub

Optional ) ' )1- = Sub MySub(ByVal Y As Byte, Optional ByVal X As Integer End Sub ' )Sub MySub(Optional ByVal X As Integer = -1, ByVal Y As Byte End Sub

( :

:ParamArray

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 73 Function Sum(ByVal ParamArray Nums() As Integer) As Integer Dim counter As Integer For counter = 0 To UBound(Nums) Sum += Nums(counter) Next End Function

: ArabicConsole.WriteLine ( Sum (1) ) ArabicConsole.WriteLine ( Sum (2, 2) ) ArabicConsole.WriteLine ( Sum (1, 2, 3, 4, 5) ) ' ArabicConsole.WriteLine ( Sum (1, , 3) ) ' 1 ' 4 ' 15

Windows API ! Windows API Windows . Windows API Declare .. NET Framework Windows ME Windows 98 Unicode

Auto . Auto Unicode Ansi :Ansi

Module Module1 Declare Auto Function GetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, _ ByRef nSize As Integer) As Integer Sub Main () GetUserName (x, y) End Sub End Module

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

47 :

. If Then Select Case .Visual Basic .NET

If Then ' 1 = If X = 0 Then Y 4 = If X = 1 Then X = 2 : Y 2 = If Y = 1 Then X = 0 Else X ' If X = 0 Then 1 = Y End If If X = 1 Then 0 = X 4 = Y End If If Y = 1 Then 0 = X Else 2 = X End If

If Then

End If ) (:

":" "_" .

End If :

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 57 If X = 0 Then If Y = 0 Then 001 = X End If Else 1 = Y End If

)

( :

1 = If X = 0 Then If Y = 0 Then X = 100 Else Y

! .NET :

Else Visual Basic

If X = 0 Then If Y = 0 Then 001 = X Else 1 = Y End If End If

: If Then End If .

) ... Not Or And( :Visual Basic .NET

:

If x > 0 And t < 1 Then End If If Not Y > 1 Then

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

67 :

:If X 0 And 10 \ X = 2 Then

X . X Visual Basic .NET .

X ) False(. And AndAlso :If X 0 AndAlso 10 \ X = 2 Then

Visual Basic .NET

X Visual Basic .NET AndAlso OrElse

. :True

' ' X ' If X > 0 OrElse Y < 0 Then

AndAlso OrElse

) (Option Strict Off

True And Or bit-wise operators :3 = x 21 = y If x 0 And y 0 Then ' True

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 77

AndAlso : ' ' True And True = True If x AndAlso y Then

And : ' )' 0011 And 1100 = 0000 (False If x And y Then

:ElseIf

If X = 1 Then ElseIf X = 2 Then ElseIf X = 3 Then Else End If

Select Case :Dim X As Integer Select Case X 1 Case ArabicConsole.WriteLine 2 Case ArabicConsole.WriteLine 21 Case ArabicConsole.WriteLine Case Else ArabicConsole.WriteLine End Select

Select Case

)""( )""(

)" "( )" "(

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

78 :

Select Case

:

Dim Grade As Integer Select Case Grade Case Is < 60 ArabicConsole.WriteLine Case 60 To 69 ArabicConsole.WriteLine Case 70 To 79 ArabicConsole.WriteLine Case 80 To 89 ArabicConsole.WriteLine Case Is >= 90 ArabicConsole.WriteLine End Select

(")" (")" (")" (")" (")"

: Dim Letter As Char Select Case Letter Case "A"c To "Z"c, "a"c To "z"c ArabicConsole.WriteLine (")" Case "0"c To "9"c ArabicConsole.WriteLine (")" Case "."c, ":"c, " "c, ";"c, "?"c ArabicConsole.WriteLine (")" Case Else ArabicConsole.WriteLine (")" End Select

: Or Select Case True Case x > 0, Y < 0 ' ' If (X > 0) Or (Y < 0) End Select

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 97 Select Case False 0 < Case x > 0, Y ' ) )0 < ' If ( Not (X > 0) ) Or ( Not (Y End Select

:For NextDim counter As Integer 4 For counter = 2 To ' )ArabicConsole.WriteLine(counter Next

:Step1- For counter = 5 To 1 Step

Next

:1- For counter = 5 To 1 Step Next 0 1 ' 0 ' )ArabicConsole.WriteLine(counter

:

001 For counter = 1 To 001 = counter Next

:Exit For

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

08 : 05 For counter = 1 To If y = 10 Then Exit For End If Next

For Each Arrays

:Collections

Dim x(5) As Integer Dim y As Integer For Each y In x )ArabicConsole.WriteLine(y Next

For Each .

Do Loop

) (. Until True While :True", MsgBoxStyle.YesNo) = MsgBoxResult.Yes "(Do Until MsgBox Loop ", MsgBoxStyle.YesNo) = MsgBoxResult.No "(Do While MsgBox Loop

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 18

.Exit Do For Next :Do Loop

For Next Do Loop For Next :

5 = A ' For Next For counter = 1 To A Next ' Do Loop 1 = counter Do 1 + counter = counter Loop Until counter > A

A For Next

A .Do Loop

Namespaces Namespaces Namespace ) Classes Modules ... Structures( . :Mouse

Structure Mouse End Structure

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

28 :

- - .Mouse .

Project - - . Project Property Pages

) Root namespace 2 -5(.

2 -5: . - - . Namespace :End Namespace

Namespace Devices End Namespace

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 38

Classes Modules Structures Interfaces Enumd :

Namespace Devices Structure Mouse End Structure Structure Printer End Structure End Namespace Namespace Animals Structure Mouse End Structure Structure Cat End Structure End Namespace

Classes Interfaces . Modules - Enums Structures .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

48 :

:NestedNamespace Devices Namespace Inputs Structure Mouse End Structure Structure Keyboard End Structure End Namespace Namespace Outputs Structure Monitor End Structure Structure Printer End Structure End Namespace End Namespace

:Dim X As Animals.Mouse Dim Y As Devices.Mouse

Structures:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 58 Dim X As Devices.OutPuts.Printer Dim Y As Devices.OutPuts.Screen Dim Z As Devices.Inputs.Keyboard

) ( ' Devices.Inputs Dim X As Keyboard Dim Y As Mouse ' Dim Z As OutPuts.Printer

:

Imports :

Dim X As Devices.OutPuts.Printer Dim Y As Devices.OutPuts.Screen Dim Z As Devices.Inputs.Keyboard

Devices :ImportsImports MyNameSpace.Devices Dim X As OutPuts.Printer Dim Y As OutPuts.Screen Dim Z As Inputs.Keyboard

:Imports MyNameSpace.Devices.OutPuts Imports MyNameSpace.Devices.Inputs Dim X As Printer Dim Y As Screen Dim Z As Keyboard

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

68 :

Imports ) (. MyNameSpace .

:

Imports MyNameSpace.Animals Imports MyNameSpace.Devices.Inputs Dim X As Mouse

Mouse . :

Imports MyNameSpace.Animals Imports tmp = MyNameSpace.Devices.Inputs Dim X As Mouse Dim Y As tmp.Mouse

) .NET

(Framework ) Solution Explorer 2 -6 (.

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 78

2 -6: .

Imports ) (Imports Imports ) Project Property Pages 2 -7(.

2 -7: .Imports

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

88 :

Imports .

.Visual Basic .NET

Delegates .

Inheritance Interfaces Attributes

.

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

3

OOP Visual Basic Visual Basic .NET ! Visual Basic .NET OOP OOP

) Multiple Inheritance .NET ++ Visual C (.

.

.NET Framework

- OOP . !

Classes Visual Basic .NET Structures : .

Structure Person Dim Name As String Dim Age As Integer End Structure

Class :Structure

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

09 : Class Person Dim Name As String Dim Age As Integer End Class

Reference Type .Value Type

Private Public :

Class Person ' Public Public Name As String Public Age As Integer End Class

) ( Person New :)(Dim Turki As New Person " " = Turki.Name 99 = Turki.Age )ArabicConsole.WriteLine(Turki.Name )ArabicConsole.WriteLine(Turki.Age ' 99 '

) Sub (Function

Public :' Public

Class Person )( Sub PublicMethod End Sub )( 2Public Sub PublicMethod End Sub

' Public

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 19 )( Friend Sub FriendMethod End Sub )( Private Sub PrivateMethod End Sub End Class ' Friend

' Private

: ' Class PersonClass End Class ' Structure PersonStructure End Structure

Interfaces .

Nested:Class Car Class Engine Public Cylinder As Integer End Class Public Model As String )(Public CarEngine As New Engine End Class

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

29 :

New :

)(Dim BMW As New Car "3002" = BMW.Model 21 = BMW.CarEngine.Cylinder )ArabicConsole.WriteLine(BMW.Model )ArabicConsole.WriteLine(BMW.CarEngine.Cylinder 3002 ' 21 '

Visibility Friend

Public

Private

Private Module Class :Structure

' Friend Class FriendClass End Class 1Module Module ' Friend 2Class FriendClass End Class ' Friend 3Friend Class FriendClass End Class ' Public Public Class PublicClass End Class ' Private Private Class PrivateClass End Class End Module

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 39

Friend Private Public Protected .Protected Friend . ) (!

. )

) (ByVal (:

1Module Module Class TestClass Public X As Integer End Class )(Sub Main )(Dim TestObject As New TestClass 01 = TestObject.X )SendByValue(TestObject 1 01 ' )ArabicConsole.WriteLine(TestObject.XEnd Sub )Sub SendByValue(ByVal obj As TestClass 1- = obj.X End Sub End Module

.NET C )

Classes Structures

Reference Type Value Type - .

( PascalCase

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

49 :

Public Friend camelCase

:Private

' ' CEmployeeData Class EmployeeData Public EmployeeName As String Friend EmployeeAge As Integer Dim motherName As String Private salaryAmount As Decimal End Class

' Private ' Private

Class Members: .

-.NET .

Fields -

Fields

5 :

Class SimpleClass Public Field1 As String Freind Field2 As Integer Dim field3 As Double Dim field4 As Boolean Private field5 As PersonClass End Class

Structure :Class SimpleClass " " = Public Field1 As String 99 = Freind Field2 As Integer End Class

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 59

) LIFO :(FIFO

Class SimpleClass Public Field1 As SimpleClass 0 = Public Field2 As Integer End Class

: )(Dim SimpleObject As New SimpleClass )(SimpleObject.Field1 = New SimpleClass 01 = 2SimpleObject.Field1.Field 0 ' )2ArabicConsole.WriteLine(SimpleObject.Field )2ArabicConsole.WriteLine(SimpleObject.Field1.Field 01 '

(Last-In-First-Out) LIFO (First-In-First-Out) FIFO . . .NET Framework Stack Queue .

) (

:

Class ArrayClass Public X() As Integer Public Y(9) As Integer End Class

ReDim :

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

69 : )(Dim ArrayObject As New ArrayClass ' 001 = )0(ArrayObject.X 002 = )1(ArrayObject.X ' )99(ReDim ArrayObject.Y 01 = )0(ArrayObject.Y 02 = )1(ArrayObject.Y

ReadOnly :

Class SimpleClass )(Public ReadOnly CreatedDate As Date = Now End Class

ReadOnly :

)(Dim SimpleObject As New SimpleClass ' )(SimpleObject.CreatedDate = Now ' )ArabicConsole.WriteLine(SimpleObject.CreatedDate

Fields Methods

Methods

) Subs (Functions.

.NET Framework - .Methods

.

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 79 Class PersonRecord Public Name As String Public Age As Integer Public Address As String _ ,Sub SetValues(ByVal PersonName As String )ByVal PersonAge As Integer, ByVal PersonAddress As String Name = PersonName Age = PersonAge Address = PersonAddress End Sub End Class

:Dim PersonObject As New PersonRecord ' " " = PersonObject.Name 99 = PersonObject.Age " " = PersonObject.Address ' )" " ,99 ," "(PersonObject.SetValues

Structures

Static :

Class TestClass )(Sub Method Static X As Integer End Sub End Class Structure TestStructure )(Sub Method Static X As Integer End Sub End Structure

'

'

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

89 :

.NET PascalCase

camelCase :

)Sub ShutDown (computerName As String End Sub

OOP Overloading

:Overloading

:

Class SimpleClass ' SameName ' )(Sub SameName End Sub )Sub SameName(ByVal X As Integer End Sub )Sub SameName(ByVal Y As String End Sub End Class

)( SameName :

)Sub SameName(ByVal X As String End Sub ' )Sub SameName(ByVal Y As String End Sub

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 99

) ByRef (ByVal :

)Sub SameName(ByVal X As String End Sub ' )Sub SameName(ByRef Y As String End Sub

:)Public Sub SameName(ByVal X As String End Sub ' )Friend Sub SameName(ByVal X As String End Sub

Optional . :)0 = Sub SameName(Optional ByVal X As Integer End Sub ' )"..." = Sub SameName(Optional ByVal X As String End Sub

Optional. .

Overloads :

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

001 : )Overloads Sub SameName(ByVal X As String End Sub )Overloads Sub SameName(ByVal X As Integer End Sub

- Overloads - ) ( .

:

Class TestClass )Overloads Sub SameName(ByVal X As Integer )" "(ArabicConsole.WriteLine End Sub )Overloads Sub SameName(ByVal X As String )" "(ArabicConsole.WriteLine End Sub End Class

:)(Dim TestObject As New TestClass 001 = Dim A As Integer "001" = Dim B As String ' )TestObject.SameName(A ' )TestObject.SameName(B

.

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 101 )(Dim TestObject As New TestClass "001" = Dim A As String ' ' ))TestObject.SameName(CInt(A

Widening Conversion Narrowing Conversion :

01 = Dim A As Byte Dim B As Char = "A"c 01 = Dim C As Long ' )TestObject.SameName(A ' )TestObject.SameName(B ) ( ' )TestObject.SameName(C

.

) If Then .(Select Case

) ( :

)Sub OpenByID (ByVal id As Integer End Sub )Sub OpenByName (ByVal name As String End Sub

) String (Integer

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

201 :

Open :

)Overloads Sub Open (ByVal id As Integer End Sub )Overloads Sub Open (ByVal name As String End Sub

Modules .Structures :Constructors

Constructor Method )( Sub New :Class TestClass )(Sub New )" "(ArabicConsole.WriteLine End Sub End Class

TestClass

:New

' ' )(Dim TestObject As New TestClass

) (:

)(Dim TestObject As New TestClass Dim TestObject2 As TestClass TestObject2 = TestObject

' ' '

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 301

Parameters .

) ( :

Class PersonClass Public FirstName As String Public LastName As String ' )Sub New(ByVal firstN As String, ByVal lastN As String FirstName = firstN LastName = lastN End Sub End Class

:

' )(Dim TestObject As New PersonClass ' )"" ,""(Dim TestObject As New PersonClass

Optional ) Overloading ( :

' Class PersonClass ,"" = Sub New(Optional ByVal firstN As String )"" = Optional ByVal lastN As String FirstName = firstN LastName = lastN End Sub End Class

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

401 : ' ' Class PersonClass )(Sub New End Sub )Sub New(ByVal firstN As String, ByVal lastN As String FirstName = firstN LastName = lastN End Sub End Class

Overloads .

Recursively :RecursionClass TestClass )(Sub New )(New End Sub End Class

'

Visual Basic .NET

) Me Me (:

Class TestClass )(Sub New ' )001(Me.New End Sub )Sub New(ByVal X As Integer End Sub End Class

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 501

)( Sub New ) Sub New(X As Integer Visual Basic .NET .

:ReadOnly

Class TestClass 1- = Public ReadOnly X As Integer )(Sub New 001 = X End Sub End Class '

Properties Properties Fields Methods . Methods

. Property :

Class PersonClass Property BirthDate() As Date ' Date End Property End Class

Get Set Private :

' Private m_BirthDate As Date Property BirthDate() As Date Get Return m_BirthDate End Get

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

601 : ' Value Date ' ByVal )Set(ByVal Value As Date m_BirthDate = Value End Set End Property

:

)(Dim Turki As New PersonClass #3091/1/1# = Turki.BirthDate )ArabicConsole.WriteLine(Turki.BirthDate

BirthDate Set ) Value (ByVal - Return .Functions Read Only BirthDate Get

Get Set :

Property ReadOnly ) Set

(. :(BirthDate

Age )

ReadOnly Property Age() As Integer Get )Return DateDiff(DateInterval.Year, BirthDate(), Now End Get End Property

) ( :

WriteOnly Get

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 107 WriteOnly Property Password() As String Set(ByVal Value As String) m_Password = Value End Set End Property

Parameters

:

Private m_Address(2) As String Property Address(ByVal index As Integer) As String Get If index >= 0 And index = 0 And index )" "()" "()", Tested:=False "=:", TesterName "()", Tested:=True "=:", TesterName "( s 1- Case )"2ArabicConsole.WriteLine("s1 < s End Select

Case-sensitive

" "turki TURKI )( Compare

:True

0 ' ))ArabicConsole.WriteLine(String.Compare("TURKI", "turki", True

) ( ""

"":1 ' 0 '

))"" ,""( ArabicConsole.WriteLine (String.Compare ))"", ""(ArabicConsole.WriteLine(String.Compare

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 342

) ( .

)( CompareOrdinal UNICODE ) ...(:

)( Compare

)"" ,""( ArabicConsole.WriteLine(String.CompareOrdinal 0 ' 91- ' )"" ,""( ArabicConsole.WriteLine(String.CompareOrdinal

Visual Basic .NET .NET .... Framework

CultureInfo

System.Globalization

.NET Framework .NET Documentation Microsoft CultureInfo - - .CultureInfo

) ...(

LCID

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

442 : .NET Framework

)( CurrentCulture . :

' Imports System.Globalization ' )(Dim KSA As CultureInfo = CultureInfo.CurrentCulture With KSA ' ar-SA )ArabicConsole.WriteLine(.Name )' Arabic (Saudi Arabia )ArabicConsole.WriteLine(.EnglishName ) ( ' )ArabicConsole.WriteLine(.NativeName 5201 ' )ArabicConsole.WriteLine(.LCID End With

ar-SA 5201 :)"Dim KSA As New CultureInfo("ar-SA ' )5201(Dim KSA As New CultureInfo

:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 542

. . .

10400x 10410x 100x3C 100x0C 10800x 100x2C 10430x 10030x 10010x 10810x 10020x 10040x 10820x 100x1C 10830x 10420x 10000x

ar-SA ar-DZ ar-BH ar-EG ar-IQ ar-JO ar-KW ar-LB ar-LY ar-MA ar-OM ar-QA ar-SY ar-TN ar-AE ar-YE ar

.

. .

.

.

.

. .

. . . .

.

:

) 342(

0 ' _ ,)"", ""(ArabicConsole.WriteLine(String.Compare )))", False, New CultureInfo("ar-SA

CultureInfo CompareInfo

)() Compare (String CompareOptions.IgnoreSymbols:

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

642 : .NET Framework

)"Dim KSA As New CultureInfo("ar-SA 1 ' )"", ""(ArabicConsole.WriteLine(String.Compare 0 ' _ ,"", ""(ArabicConsole.WriteLine(KSA.CompareInfo.Compare ))CompareOptions.IgnoreSymbols

CompareOptions.IgnoreNonSpace

:

0 ' _ ,"", ""(ArabicConsole.WriteLine(KSA.CompareInfo.Compare ))CompareOptions.IgnoreNonSpace

Enum :Or_ ,2ArabicConsole.WriteLine(KSA.CompareInfo.Compare(s1, s ))CompareOptions.IgnoreNonSpace Or CompareOptions.IgnoreSymbols

CompareOptions.IgnoreSymbols )( CompareInfo.Compare : % .....

)( IndexOf

-1 :"?Dim x As String = "Can you find the word find ))"ArabicConsole.WriteLine(x.IndexOf("find ))"ArabicConsole.WriteLine(x.IndexOf("Find 8 ' 1- '

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 742

)( IndexOf

:

"?Dim x As String = "Can you find the word find 0 = Dim index As Integer Do )1 + index = x.IndexOf("find", index If index < 0 Then Exit Do Else )ArabicConsole.WriteLine(index End If Loop

:

" " = Dim x As String 93 ' ))""(ArabicConsole.WriteLine(x.IndexOf 32 ' ))""(ArabicConsole.WriteLine(x.IndexOf

)( IndexOf CompareInfo :CompareOptions.IgnoreSymbols" " = Dim x As String )"Dim KSA As New CultureInfo("ar-SA 32 ' _ ,"" ,ArabicConsole.WriteLine(KSA.CompareInfo.IndexOf(x 32 ' ))CompareOptions.IgnoreSymbols

CultureInfo

Char c

Char :String

Char

Dim X As Char = "A"c "Dim Y As Char = "B

'

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

842 : .NET Framework

Char Shared Methods

) )( (Isxxx Boolean

:' True ' True ' True ' True ' True

' ))ArabicConsole.WriteLine(Char.IsDigit("1"c ' ))"c"(ArabicConsole.WriteLine(Char.IsLetter ' ))ArabicConsole.WriteLine(Char.IsLetterOrDigit("X"c ' ))ArabicConsole.WriteLine(Char.IsLower("a"c ' ))ArabicConsole.WriteLine(Char.IsPunctuation(""""c

String

:

ArabicConsole.WriteLine(Char.IsDigit("A1", 0)) ' False ArabicConsole.WriteLine(Char.IsDigit("A1", 1)) ' True

: Char Value Type

Reference Type .String .

-

StringBuilder

) ( :

" " = Dim x As String )ArabicConsole.WriteLine(x ' ' ))" " ,8(ArabicConsole.WriteLine(x.Insert ))4 ,4(ArabicConsole.WriteLine(x.Remove '

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 942

Managed Heap " " " "

" " :

" " = Dim x As String )" " ,8(Dim y As String = x.Insert )4 ,4(Dim z As String = x.Remove )ArabicConsole.WriteLine(x )ArabicConsole.WriteLine(y )ArabicConsole.WriteLine(z ' ' '

Reference Type

Managed Heap .Garbage Collection . Garbage Collection Reference Type .

System.Text.StringBuilder ) (String Buffer String Buffer Capacity .

:

100 String Buffer ' 05 ' )(Dim x As New System.Text.StringBuilder 001 = x.Capacity ' )05(Dim x As New System.Text.StringBuilder

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

052 : .NET Framework

String

) )( Remove() Insert( - StringBuilder - :

)"" ,0(x.Insert )" " ,4(x.Insert ' ' )ArabicConsole.WriteLine(x

)( Append

:

)(Dim x As New System.Text.StringBuilder Dim counter As Integer 9 For counter = 1 To )x.Append(counter Next 987654321 ' )ArabicConsole.WriteLine(x

StringBuilder String String :StringBuilder

)05(Dim Y As New System.Text.StringBuilder ' " " = Y

: Single Long Integer Short Byte Integer Short Long : 61Int Double Decimal .Value Type .NET Framework

23 Int 46 Int .

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 152

94-05.

. MaxValue MinValue ReadOnly :Shared

Dim Dim Dim Dim

X Y Z W

As As As As

Byte Integer Long Double ' ' ' ' 0 8463847412- 7085774586302733229 803+1.79769313486232E

)ArabicConsole.WriteLine(X.MinValue )ArabicConsole.WriteLine(Y.MinValue )ArabicConsole.WriteLine(Z.MaxValue )ArabicConsole.WriteLine(W.MaxValue

)( Epsilon - :

) Floating-point Single (Double

Dim X As Double Dim Y As Single 803+ArabicConsole.WriteLine(X.MinValue) ' -1.79769313486232E 423-ArabicConsole.WriteLine(X.Epsilon) ' 4.94065645841247E 83+ArabicConsole.WriteLine(Y.MinValue) ' -3.402823E 54-ArabicConsole.WriteLine(Y.Epsilon) ' 1.401298E

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

252 : .NET Framework

)( ToString

:String

001 = Dim x As Integer 001 ' )ArabicConsole.WriteLine(x.ToString

)(ToString # 0 :

01 = Dim x As Integer 01 ' ))"####"(ArabicConsole.WriteLine(x.ToString 0100 ' ))"0000"(ArabicConsole.WriteLine(x.ToString

.NET Documentation "." "," "%" " "E

:Exponential Form

Dim Dim Dim Dim

X Y Z w

As As As As

4321.001 = Single 9999999 = Integer 1.0 = Double 0000000000051 = Long ' ' ' ' 1.0010 999,999,9 % 0.01 01+150 E

))"#.0000"(ArabicConsole.WriteLine(X.ToString ))"###,###,###"(ArabicConsole.WriteLine(Y.ToString ))"% 0.##"(ArabicConsole.WriteLine(Z.ToString ))"0+ArabicConsole.WriteLine(w.ToString("### E

) (:

987654321 = Dim MyDouble As Double ' Currency .. 00.987,654,321 ' ))"ArabicConsole.WriteLine(MyDouble.ToString("C ' Scientific 800+ArabicConsole.WriteLine(MyDouble.ToString("E")) ' 1.234568E

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

: 253 ' Percent ArabicConsole.WriteLine(MyDouble.ToString("P")) ' 12,345,678,900.00% ' Number ArabicConsole.WriteLine(MyDouble.ToString("N")) ' 123,456,789.00 ' Fixed-point ArabicConsole.WriteLine(MyDouble.ToString("F")) ' 123456789.00

NumberFormat :(

)ToString() CultureInfo

Imports System.Globalization Dim Germany As New CultureInfo("de-DE") Dim MyDouble As Double = 123456789 With Germany ' 123.456.789,00 ArabicConsole.WriteLine(MyDouble.ToString("C", ' 1,234568E+008 ArabicConsole.WriteLine(MyDouble.ToString("E", ' 12,345,678,900.00% ArabicConsole.WriteLine(MyDouble.ToString("P", ' 123.456.789,00 ArabicConsole.WriteLine(MyDouble.ToString("N", ' 123456789,00 ArabicConsole.WriteLine(MyDouble.ToString("F", End With

.NumberFormat)) .NumberFormat)) .NumberFormat)) .NumberFormat)) .NumberFormat))

NumberFormat

NumberFormatInfo :

Imports System.Globalization Dim Custom As New NumberFormatInfo() Dim X As Double = -12345.6789 ' Custom.NumberDecimalSeparator = ";" ' Custom.NegativeSign = "*" ArabicConsole.WriteLine(X.ToString("", Custom)) ' *12345;6789

PDF created with pdfFactory Pro trial version

w w.pdf actory.com

452 : .NET Framework

Microsoft.VisualBasic.Math

Math

Microsoft.VisualBasic :

Imports Microsoft.VisualBasic

)(01 Log )( Sign 1 1 0 :01 '