473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VB 6.0 Auotfiltering in textbox

HI...Im researching for how to auto filter the text box while im typing inside it (ex. I type A in the VB textbox and all records that have letter A will appear dropdown and as I proceed typing Am all records that have Am will appear dropdown) plzzzzzzzzzzzzzz..... any one can give me some code how to do this in my VB 6.0 project....Im using sql as my database!



I will be thankful if any one will reply!thnx....
Sep 3 '07 #1
11 6900
hariharanmca
1,977 1GB
HI...Im researching for how to auto filter the text box while im typing inside it (ex. I type A in the VB textbox and all records that have letter A will appear dropdown and as I proceed typing Am all records that have Am will appear dropdown) plzzzzzzzzzzzzzz..... any one can give me some code how to do this in my VB 6.0 project....Im using sql as my database!



I will be thankful if any one will reply!thnx....

Use the query like

Expand|Select|Wrap|Line Numbers
  1. strSql = "Select <Field Names> from <Table Name> where <Search Field> like '" & strSearchText & "%'"
Sep 3 '07 #2
Killer42
8,435 Expert 8TB
... auto filter the text box while im typing inside it (ex. I type A in the VB textbox and all records that have letter A will appear dropdown and as I proceed typing Am ...
I'm guessing you must be referring to a listbox or something of that sort? A textbox can only display one thing at a time.
Sep 4 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

use a ComboBox, It can Act as both TextBox and a ListBox. Write the Code in KeyPresss event, to populate the Combo..

REgards
Veena
Sep 4 '07 #4
hariharanmca
1,977 1GB
Combo Box is not good for huge list because that will not automatically show the list and we should add 3 to 30 items (Static Data).

We have to use programmatically adding items in ‘List Box’ or ‘List view’ with ‘Text Box’ combination.
Sep 4 '07 #5
QVeen72
1,445 Expert 1GB
Hi hari,

what is this " we should add 3 to 30 items (Static Data)"....?
Why do we need to add Static Data...?

I always prefer TextBox + ListBox Combination with "Sorted" property of the ListBox =True. Since he said he wants to type, I suggested ComboBox


REgards
Veena
Sep 4 '07 #6
syamas
10
HI...Im researching for how to auto filter the text box while im typing inside it (ex. I type A in the VB textbox and all records that have letter A will appear dropdown and as I proceed typing Am all records that have Am will appear dropdown) plzzzzzzzzzzzzzz..... any one can give me some code how to do this in my VB 6.0 project....Im using sql as my database!



I will be thankful if any one will reply!thnx....

Hey friend
use a frame named 'framepartdet'
put MSFlex grid named 'searchgrid' on 'framepartdet' with three columns, fixed rows 2



Expand|Select|Wrap|Line Numbers
  1. Private Sub txtcode_Change()    'event
  2. Dim i As Integer
  3.   If rsstock.State = adStateOpen Then rsstock.Close
  4.   Dim ccode As String
  5.  If txtcode.Text = "" Then   ' text box value
  6.  framepartdet.Visible = False
  7.  Exit Sub
  8.  End If
  9.     ccode = Trim(txtcode.Text)
  10.     rsstock.Open "select distinct code,name from table where field like '" & ccode & "%' ", cn, adOpenDynamic, adLockOptimistic
  11.    If Not rsstock.EOF And Not rsstock.BOF Then
  12.       framepartdet.Visible = true
  13.       rsstock.MoveFirst
  14.       i = 0
  15.       searchgrid.Rows = 1
  16.       Do While Not rsstock.EOF
  17.          With searchgrid
  18.             .TextMatrix(i, 0) = i+1  
  19.             .TextMatrix(i, 1) = "" & rsstock.Fields(0)
  20.             .TextMatrix(i, 2) = "" & rsstock.Fields(1)
  21.                        i = i + 1
  22.             .Rows = .Rows + 1
  23.              End With
  24.         rsstock.MoveNext
  25.        Loop
  26.    Else
  27.     framepartdet.Visible = False
  28.     End If
  29.    rsstock.Close   
  30. End Sub
* link removed *

Sep 4 '07 #7
hariharanmca
1,977 1GB
Hi hari,

what is this " we should add 3 to 30 items (Static Data)"....?
Why do we need to add Static Data...?

I always prefer TextBox + ListBox Combination with "Sorted" property of the ListBox =True. Since he said he wants to type, I sujjested ComboBox


REgards
Veena
we should add 3 to 30 items (Static Data)"....?
That is not exact count (that is approximate).
Static Data - I mean which will change the list index during key press or key up event.
Sep 4 '07 #8
thanks!for your reply but i can't get it...can u plz instruct me the step by step method on how can I make a textbox searching in vb6 using my sql database!sorry for being slow...Im only a noob in VB6...
Sep 12 '07 #9
Hi hari,

what is this " we should add 3 to 30 items (Static Data)"....?
Why do we need to add Static Data...?

I always prefer TextBox + ListBox Combination with "Sorted" property of the ListBox =True. Since he said he wants to type, I suggested ComboBox


REgards
Veena

Hi QVeen72
tnx for the response...can you teach me how to use combobox in filtering?ex.when I type A all names starting A will appear and if i type Ab all names with Ab appear and the names with the letter A but without b will disappear!how can I do that?
Sep 12 '07 #10
tnx for the response...can you teach me how to use combobox in filtering?ex.when I type A all names starting A will appear and if i type Ab all names with Ab appear and the names with the letter A but without b will disappear!how can I do that?
Sep 12 '07 #11
Hey friend
use a frame named 'framepartdet'
put MSFlex grid named 'searchgrid' on 'framepartdet' with three columns, fixed rows 2



Expand|Select|Wrap|Line Numbers
  1. Private Sub txtcode_Change()    'event
  2. Dim i As Integer
  3.   If rsstock.State = adStateOpen Then rsstock.Close
  4.   Dim ccode As String
  5.  If txtcode.Text = "" Then   ' text box value
  6.  framepartdet.Visible = False
  7.  Exit Sub
  8.  End If
  9.     ccode = Trim(txtcode.Text)
  10.     rsstock.Open "select distinct code,name from table where field like '" & ccode & "%' ", cn, adOpenDynamic, adLockOptimistic
  11.    If Not rsstock.EOF And Not rsstock.BOF Then
  12.       framepartdet.Visible = true
  13.       rsstock.MoveFirst
  14.       i = 0
  15.       searchgrid.Rows = 1
  16.       Do While Not rsstock.EOF
  17.          With searchgrid
  18.             .TextMatrix(i, 0) = i+1  
  19.             .TextMatrix(i, 1) = "" & rsstock.Fields(0)
  20.             .TextMatrix(i, 2) = "" & rsstock.Fields(1)
  21.                        i = i + 1
  22.             .Rows = .Rows + 1
  23.              End With
  24.         rsstock.MoveNext
  25.        Loop
  26.    Else
  27.     framepartdet.Visible = False
  28.     End If
  29.    rsstock.Close   
  30. End Sub
* link removed *



Hi syamas

tnx for the response...can you teach me how to use combobox in filtering?ex.when I type A all names starting A will appear and if i type Ab all names with Ab appear and the names with the letter A but without b will disappear!how can I do that?
Sep 12 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jonas L | last post by:
Hi, I need to create a textbox which acts as a normal textbox but with the following extra requirements: 1) In-focus color, when the textbox gets focus the backcolor property of the textbox...
4
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with...
0
by: Newasps | last post by:
Hi guys, I have a problem with UpdateCommand Event. In tihs event Ä°'m creating required controls to get that controls' values and also get them. But when I try to get updated values I'm getting the...
7
by: I am Sam | last post by:
I have a DataGrid that is passing information to a stored procedure properly but the parameters aren't being casted properly. I was woundering if anyone can tell me how I should properly cast the...
2
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
3
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. ...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
8
by: Marco Pais | last post by:
Hi there. How can I change the background color of a textbox when it gets the focus? I can handle the "Enter" event and do this private void txtDummie_Enter(object sender, EventArgs e) { ...
1
by: Andy B | last post by:
I have this code: protected void EditEventsWizard_NextButtonClick(object sender, WizardNavigationEventArgs e) { //get the values from the DetailsView TextBox StartTime =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.