checking for string that has a value in VB

I'm using ASP.NET Web Forms and VB.

I have this code

Dim strparam1 = "hello"
' if string is empty or null do what's inside if statement
If ( String.IsNullOrEmpty(strparam1) ) Then


End If

Open in new window



What is the opposite of IsNullorEmpty?

I'm trying to set this logic on the if statment

If this variable strparam1 contains a value, which in this case it contains "hello" I want it to run what's inside the if statement.
If this variable strparam1 = "", then don't run what's inside the if statement.
LVL 1
maqskywalkerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

it_saigeDeveloperCommented:
Use Not; e.g. -
Dim str As String = "hello"
If Not String.IsNullOrEmpty(str)
    ' I am doing something with a string that is not null or empty
Else
    ' I am doing something with a string that is null or empty
End If

Open in new window

Proof of concept -
Module Module1
	Sub Main()
		Dim strings = {Nothing, "Hello", ""}
		For Each value In strings
			If Not String.IsNullOrEmpty(value) Then
				Console.WriteLine($"Value is not null or empty; Contains - {value}")
			Else
				Console.WriteLine("Value is null or empty")
			End If
		Next
		Console.ReadLine()
	End Sub
End Module

Open in new window

Produces the following output -Capture.PNG-saige-
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maqskywalkerAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.