Check property value

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have the following custom control property:

' Example
Private _Example As String
< _
Bindable(True), _
Category("Appearance"), _
DefaultValue(""), _
Localizable(True) _
Property Example() As String
Get
Return _Example
End Get
Set(ByVal value As String)
_Example = value
End Set
End Property ' Example

What is the difference between using:

If Me.Example = Nothing Then
If Me.Example Is Nothing Then
If String.IsNullOrEmpty(Me.Example) Then

Thanks,

Miguel
 
Hello,

I have the following custom control property:

' Example
Private _Example As String
< _
Bindable(True), _
Category("Appearance"), _
DefaultValue(""), _
Localizable(True) _
Property Example() As String
Get
Return _Example
End Get
Set(ByVal value As String)
_Example = value
End Set
End Property ' Example

What is the difference between using:

If Me.Example = Nothing Then
If Me.Example Is Nothing Then
If String.IsNullOrEmpty(Me.Example) Then

Thanks,

Miguel

IsNullOrEmpty checks if string is a null or an Empty string ("").

According to the following bug report it might not work
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=113102

"If Me.Example = Nothing Then" should be used with "IS" instead of "="
 
Back
Top