.


:




:

































 

 

 

 


2

 

Visual Studio.NET, , , .

( 5) ( ). . .

 

.

.

, .

.

 

 

VB.NET 255 Unicode ( Unicode www.unicode.org), . , . , ; , firstBase firstbase . =

 

theYear = 2001

 

.NET Framework . , MSDN, , ( , i t) .

, VB.NET ( . 4.1), , . , Loop, [Loop] . (, loopit ). VB.NET ( ).

 

4.1.

 

AddressOf Alias And Ansi As
Assembly Auto Binary BitAnd Byte
BitNot BitOr BitXor Boolean ByRef ByVal
Call Case Catch CBool CByte
CChar CDate CDec Class CLng
CDbl Char CInt CObj Compare
Const CShort CSng CStr Ctype
Date Decimal Declare Default Delegate
Dim Do Double Each Else
Elself End Enum Erase Error
Event Exit Explicit ExternalSource False
Finally For Friend Function Get
GetType GoTo Handles If Implements
Imports In Inherits Integer Interface
Is Lib Like Long Loop
Me Mod Module Mustlnherit MustOverride
MyBase MyClass Namespace Next New
Not Nothing Notlnheritable NotOverridable Object
Off On Option Optional Or
Overloads Overridable Overides ParamArray Preserve
Private Property Protected Public RaiseEvent
Readonly ReDim REM RemoveHandler Resume
Return Select Set Shadows Shared Short
Single Static Step Stop Strict
String Structure Sub SyncLock Text
Then Throw To True Try
TypeOf Unicode Until When While
With With Events WriteOnly Xor

 

, .

, , , . , , 3 3 . 3 ? ? 3 2 , .

, , , , . 3. VB.NET ( ):

: , .

: Integer.

.NET: Long ( 4 ).

, 3 ( VB). VB.NET .

3 . , VB.NET, , . , 31 Integer 3, "3" String ( String ).

, VB.NET System.

, , . VB.NET.

Byte: 1- 0 255.

Short: 2- -32 768 32 767, Integer VB. Short S , 237S.

Integer: 4- -2 147 483 648 2 147 483 647, Long VB. Integer I , 2371.

, Integer, Integer. , 32- Integer .

Long: 8- -9 223 372 036 854 775 808 9 223 372 036 854 775 807. VB. Long L , 2371.

:

Single: 4- . Single F , 1.23F 3F.

Double: 8- . , Double. , Double Single; 32- Double .

Decimal: 12- , 28 . , Decimal 79 228 162 514 264 337 593 543 950 335, , 28. , , Decimal, 0.0000000000000000000000000001. Decimal D.

, . :

 

Console.WriteLine(12345678 * 4567)

 

:

 

This constant expression produces a value that is not representable in type System.Integer.

 

Long:

 

Console.WriteLine(123456781 * 4567)

 

MaxValue MinValue, , . :

 

Console.WriteLine(Integer.MaxValue)

 

4.2 VB.NET, .NET Framework VB6 ( ).

 

3.2.

VB. NET .NET Framework

Byte System. Byte

Boolean System. Boolean

Decimal System. Decimal

Double System. Double

Short System. Intl6

Integer System.Int32

Long System.Int64

Single System. Single

 

Boolean,Date Char. Bool ean True False. VB.NET 4 .

VB.NET - 1 True +1 ( .NET). - 2 -1. , True -1, 1. VB.NET VB, 1. , , , .NET, . True False, , .

Date / . #...# , #Jan 1. 2001#. ), , .

Date VB.NET Double. , , , Today+1.

Char Unicode. Unicode (65 536 ) . , (, ""), Chr Unicode. , Chr(&H2153) 1/3 Unicode, . ѻ, String Char, ( Option Strict ).

VB.NET Dim As, =:

 

Dim foo As String

foo = "bar"

 

VB.NET, . VB.NET . :

 

Dim salesTax As Decimal = 0.0825D

 

salesTax 0.0825 Decimal. VB.NET. startAngle , System. Math: Dim startAngle As Decimal - Math.PI

, , , , 0. , VB.NET, , . &, VB :

 

Sub Main()

Dim salesTax As Double = 0.0825

Dim state As String = "California"

Console.WriteLine("The sales tax in " & state & " is " & salesTax)

 

Console. ReadLine()

End Sub

 

:

 

The sales tax in California is 0.0825

 

VB, , . , : i, j k, Integer:

 

Dim i, j, k As Integer

 

, :

 

Dim i, j, k As Integer = 1

 

VB, As . :

 

Dim i%, myname$

 

i Integer myName String. VB.NET .

, . ( ), . .NET Framework . , .

DefType (, Deflnt) VB.NET .

, VB . , VB6 Integer.

VB.NET Option Strict. , ( Strict Type Checking Build Project Properties):

 

Option Strict On

 

( !) VB.NET , , , . , Single Integer , Integer Single. , (, Integer Long Decimal), VB.NET . VB.NET (widening conversions). 4.3 .

 

4.3. VB.NET

Byte Byte, Short, Integer, Long, Decimal Single, Double
Short Short, Integer, Long, Decimal, Single, Double
Integer Integer, Long, DecimaL Single, Double
Long Long, DecimaL Single, Double
Single Single, Double
Date Date, String

 

, :

 

Dim foo As Boolean

foo = 3

 

foo True . :

Dim foo As Boolean

foo =l()

 

VB.NET , .

. :

 

Option Strict Off

 

, .

 

, , l. 4.4.

 

4.4.

CBool Boolean

CByte Byte

CInt Integer

CIng Long

CSng Single

CDate Date

Dbl Double

CDec Decimal

CStr String

CChar Char

 

 

VB.NET , ; .

, Char ( 0 65 535), . - 2 Char CInt; Asc.

. :

Enter.

ReadLine().

, CDec (, ):

 

'

 

Option Strict On Module

Module Modulel

Sub Main()

Dim cdeg As Decimal

Console.WriteLine( Enter the degrees in centigrade...")

cdeg = CDec(Console.ReadLine())

Dim fdeg As Decimal

fdeg = (((9.0 / 5.0) * cdeg) + 32)

Console.WriteLine(cdeg & " is " & fdeg & " degrees Fahrenheit.")

Console. ReadLine()

End Sub

End Module

 

@ , Decimal. , !

/ VB.NET . .

VB.NET , . , : 255 , , , . .

VB.NET :

 

Const PIE = 3.14159 ' Option Strict

 

Const PIE As Double = 3.14159 ' , Math.PI :-)

 

, :

 

Const PIE_OVER_2 As Double = PIE / 2

 

:

 

Const USER_NAME As String = "Bill Gates"

 

Unicode 231 ( 2 !) . , :

 

Dim message As String

message = "Help"

 

() &. + , , + . $ (, aStringVariableS) .

VB.NET , String. , , , , VB.NET: VB.NET . , VB.NET StringBuilder (, ).

VB, VB.NET .

Left, Right, Mid . ., $ . 4.5 String. , (, Mid ) StringBuilder. , .

.NET String, .NET Framework. . 3.6.

 

4.5.

Asc

Chr Unicode

Filter ; ,

GetChar Char. 1. , GetChar("Hello",2) Char

InStr

InStrRev

Join

LCase

Left

Len

LTrim

Mid

Replace

Right

RTrim

Space ,

Split (, )

Str

StrComp

StrConv (, )

String ,

Trim

UCase

 

3.6. .NET Framework

/

Chars ,

Compare

Copy

Copy To ,

Empty ,

EndsWith ,

IndexOf

Insert ,

Join

LastlndexOf

Length

PadLeft .

PadRight .

Remove ,

Replace

Split ,

Starts With ,

Substring ,

ToCharArray

ToLower ,

ToUpper ,

Trim , Unicode,

TrimEnd , Unicode,

TrimStart , Unicode,

 

.NET Framework , 0.

.NET Framework , . :

 

Sub Main()

Dim river As String =" Mississippi Missippi"

'

Console. WriteLine(river. Tollpper ())

Console.WriteLine(river.ToLower())

Console.WriteLine(river.Trim())

Console. WriteLine(river. EndsWith("I"))

Console.WriteLine(river.EndsWith("i"))

Console.WriteLine(river.IndexOf("s"))

' 0!

Console.WriteLine(river.Insert(9. " river"))

'

' 0!

Console.ReadLine()

End Sub

 

:

 

MISSISSIPPI MISSIPPI

mississippi missippi

Mississippi Missippi

False

True

3

Mississi riverppi Missippi

 

 



<== | ==>
- 4.01 |
:


: 2018-11-11; !; : 172 |


:

:

, - , ; , - .
==> ...

1458 - | 1466 -


© 2015-2024 lektsii.org - -

: 0.15 .