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
 
Ad

Advertisements

A

Alexey Smirnov

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

Similar Threads

Property 1
Enum Problem 1
Use property in custom control 1
Custom web control string 2
Property. Control or View State? 1
Problem with type conversion 1
Property. What am I doing wrong? Going crazy ... 10
Enum 1

Top