msspitul Member since: 5/21/2008 From: Northborough, MA, United States

Posted - 5/21/2008 12:43:01 PM
Hi,

I have a program that was originally in VB that I am trying to convert to C#. I have converted all of it succesfully accept for a part that uses the "like" statement.

The program starts off by having the user enter a file name that they want to work with, then clicking a button so that the file is uploaded and stored in an array. The user can then type in a peice of information into a textbox, click a button, and have the app display a peice of information from the datafile based on what they typed in.


The piece that I am trying to convert looks like this:

For x = 0 To n - 1
With order(x)
If .buyername Like TextBox3.Text & "*" Then
Label5.Text = .title
End If
If .sellername Like TextBox3.Text & "*" Then
Label5.Text = .title
End If
End With
Next

I've looked into many comparisons between VB and C# to see how a process like this could be accomplished in C# and havent found anything. Any suggestions would be greatly appreciated.

Recommended Answers

All 3 Replies

Hi there msspitful and welcome to DaniWeb. I had to search on google for this, but I found your answer here:

http://bytes.com/forum/thread242168.html

I hope this helps! Please mark your thread as solved once you get the answer.:)

you could also use

buyerName.Contains(TextBox3.Text)
buyerName.BeginsWith(TextBox3.Text)
buyerName.EndsWith(TextBox3.Text)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.