Solved

Search DataGrid

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now