Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Nadeem Shah
  Where is Nadeem Shah?
 Rawalpindi
 Pakistan
 Nadeem Shah
 To: kirti bhardwaj
  Where is kirti bhardwaj?
 Chandigarh
 India
 kirti bhardwaj
 Tags
Subject: RE: Search substring
Thread ID: 267218 Message ID: 268730 # Views: 32 # Ratings: 0
Version: Visual FoxPro 9 Category: Windows Vista and VFP
Date: Wednesday, July 14, 2010 10:01:51 AM         
   


> dear experts
>
> I have a data of clients with there phone no in a grid. The complete phone no. search is done perfectly.But if i want to search partial phone no. for example no.is 9888234874 and i only know 34874 then what i have to do to search the no.
> I take a textbox in which i fill the phone no. which will then compare with the no. in the grid and the focus automatically move to that record.
> please help me.....
>
> kirti bhardwaj


Hi Kirti

I am using this technique via list control.
In text box interactive change event. Change query every key press accordingly.


Thisform.list1.RowSource='select received, subject, id  from diary;
 where ALLTRIM(upper(this.value))$ALLTRIM(upper(subject));
  or ALLTRIM(upper(this.value))$ALLTRIM(upper(remarks)) ;
  or ALLTRIM(upper(this.value))$ALLTRIM(upper(received)) into cursor sss'

Thisform.list1.Requery
Thisform.list1.Refresh
Thisform.list1.Height=250
Thisform.list1.Left=20
Thisform.list1.Width=890
Thisform.list1.Top=220
Thisform.list1.ColumnWidths="350,445,70"
Thisform.list1.ColumnCount=3
Thisform.list1.BoundColumn=3
Thisform.lbllist.caption='Received from                                                                                             Subject                                                                                                                                      Diary No' 
Thisform.lbllist.Top=Thisform.list1.Top-14
Thisform.lbllist.left=Thisform.list1.left
If Not Empty(This.Value)
	Thisform.list1.Visible=.T.
	Thisform.lbllist.Visible=.T.
Else
	Thisform.list1.Visible=.F.
	Thisform.lbllist.Visible=.f.
Endif

**in the valid event

If Lastkey()=9 Or Lastkey()=5 Or Lastkey()=24  && 9-Tab, 5-up arrow key, 24-down arrow key,
	RETURN 1
Endif





like this






Nadeem Iqbal

ENTIRE THREAD

Search substring Posted by kirti bhardwaj @ 7/3/2010 10:01:25 AM
RE: Search substring Posted by Stefan Wuebbe @ 7/3/2010 10:17:35 AM
RE: Search substring Posted by kirti bhardwaj @ 7/3/2010 10:56:56 AM
RE: Search substring Posted by Stefan Wuebbe @ 7/3/2010 11:38:51 AM
RE: Search substring Posted by kirti bhardwaj @ 7/14/2010 8:29:39 AM
RE: Search substring Posted by Samir H. @ 7/3/2010 10:18:21 AM
RE: Search substring Posted by Jun Tangunan @ 7/3/2010 1:10:56 PM
RE: Search substring Posted by Samir H. @ 7/3/2010 4:02:01 PM
RE: Search substring Posted by Jun Tangunan @ 7/3/2010 11:54:56 AM
RE: Search substring Posted by Jun Tangunan @ 7/3/2010 12:21:28 PM
RE: Search substring Posted by Nadeem Iqbal @ 7/14/2010 10:01:51 AM