Solved

Search DataGrid

Posted on 2004-10-16
4
236 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
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
Get Client IP on RDS - VB.NET 15 67
write xml in vb.net 2 32
Create a datatable in vb.net dynamically 1 22
VB.net Progress Bar - Maximum Value too large 2 15
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

839 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