VB.NETの条件判断構文(If)の使い方いろいろ

2011/08/12 11:33Update
TAGS: VB.NET | If | 条件判断 | 文字列 | String.Empty | Nothing | Null

VB.NETの条件判断構文(If)の使い方について

■条件判断構文 YES
If boolean-expression  Then

End If


■条件判断構文 NOT
If Not boolean-expression  Then

End If


■条件判断構文 NULL
If varname Is Nothing Then      ' Not  varname Is Nothing

End If


■条件判断構文 NULL/String.Empty
If varname Is String.Empty Then      ' Dim varname As String

End If

If varname.Equals(String.Empty) Then

End If

If varname = String.Empty Then

End If


■条件判断構文 NULL/""文字列
If varname = "" Then      ' Dim varname As String

End If

If varname.Equals("") Then

End If

If varname Is Nothing OrElse varname.Length = 0 Then

End If


■条件判断構文 If/ElseIf/Else
If boolean-expression  Then

ElseIf boolean-expression Then

Else

End If


■条件判断構文 And    とAndAlso
If boolean-expression1 AndAlso boolean-expression2 Then

End If


If boolean-expression1 And boolean-expression2 Then

End If


■条件判断構文 OrとOrElse
If boolean-expression1 OrElse boolean-expression2 Then

End If


If boolean-expression1 Or boolean-expression2 Then

End If

.

有关作者
Syboos.jp編集長AJavaやオープンソース情報の執筆、Webサイトの開発や運営全般の業務に携わる。

Sponsored Link


Comments

用户名 (required)

Email (will not be published) (required)

URL

Evaluation