Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Search DataGrid

Posted on 2004-10-16
4
Medium Priority
?
256 Views
Last Modified: 2010-04-23
I am currently using the following code to search a datagrid

DsLocation.Tables("tblscanorder").DefaultView.Sort = "SalesOrder"
        BindingContext(DsLocation, "tblscanorder").Position = DsLocation.Tables("tblscanorder").DefaultView.Find(TxbSearch.Text)

The field saleorder have 9 characters, I want to be able to do the search on the last 5 only as the first 4 are always the same

Example

Sales order = SOR079377

So I want to search for 79377
0
Comment
Question by:davidrichardson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Hans Langer
ID: 12327005
use the EndsWith property of the string object.

str.EndsWith("79377")
0
 
LVL 7

Author Comment

by:davidrichardson
ID: 12327066
could you give me a bit more information, Where would i use this
0
 
LVL 10

Accepted Solution

by:
Hans Langer earned 300 total points
ID: 12327525
     Dim i As Int32

      For i = 0 To ds.Tables("tblscanorder").DefaultView.Count - 1
         If Convert.ToString(ds.Tables("tblscanorder").DefaultView.Item(i).Item("TheColumnIndex")).EndsWith("79375") Then Exit For
      Next

 BindingContext(DsLocation, "tblscanorder").Position = i
0
 
LVL 7

Author Comment

by:davidrichardson
ID: 12328165
That Works Great

Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question