VB Like *

G

Guest

Hi

Does anyone know how I can use the Like statement in VB.net and C# .net?

I know it works in VB.net but when I turn on option strict, It doest like it.

How would I use this statement in VB.net and C#

If textbox1.text Like "*Week*" Then
….
End if

If(textbox1.text Like “*Week*â€)
{}
I am also looking for the wild card *

Thank you,
 
S

Samuel R. Neff

Use String.IndexOf, for "*something*", String.StartsWith for
"something*" and String.EndsWith for "*something"

HTH,

Sam


Hi

Does anyone know how I can use the Like statement in VB.net and C# .net?

I know it works in VB.net but when I turn on option strict, It doest like it.

How would I use this statement in VB.net and C#

If textbox1.text Like "*Week*" Then
….
End if

If(textbox1.text Like “*Week*”)
{}
I am also looking for the wild card *

Thank you,

B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
 
H

Herfried K. Wagner [MVP]

André said:
Does anyone know how I can use the Like statement in VB.net and C# .net?

I know it works in VB.net but when I turn on option strict, It doest like
it.

How would I use this statement in VB.net and C#

If textbox1.text Like "*Week*" Then
….
End if

The code above compiles with 'Option Strict On'!
If(textbox1.text Like “*Week*â€)
{}
I am also looking for the wild card *

There is no 1:1 replacement for 'Like' in the .NET Framework. You may want
to use 'System.Text.RegularExpressions.Regex.IsMatch' instead, which uses a
different syntax for the pattern.
 

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

Top