471,349 Members | 1,309 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

VB Like *

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,
Jul 21 '05 #1
2 2577

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

HTH,

Sam
On Tue, 8 Mar 2005 13:35:06 -0800, Andr
<An**@discussions.microsoft.com> wrote:
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.
Jul 21 '05 #2
"André" <An**@discussions.microsoft.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by William C. White | last post: by
2 posts views Thread by Albert Ahtenberg | last post: by
3 posts views Thread by James | last post: by
reply views Thread by Ollivier Robert | last post: by
1 post views Thread by Richard Galli | last post: by
4 posts views Thread by Albert Ahtenberg | last post: by
1 post views Thread by inderjit S Gabrie | last post: by
2 posts views Thread by Jack | last post: by
3 posts views Thread by Sandwick | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.