Solved

Search DataGrid

Posted on 2004-10-16
4
242 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 75 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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