Check property value

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
 
G

Guest

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 "="
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top