Welcome to Dream.In.Code
Become a VB Expert!

Join 149,491 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,295 people online right now. Registration is fast and FREE... Join Now!




Auto filling using text box in Visual Basic 6

 
Reply to this topicStart new topic

Auto filling using text box in Visual Basic 6, Text search text box VB6

fuad
31 Mar, 2007 - 12:52 PM
Post #1

New D.I.C Head
*

Joined: 31 Mar, 2007
Posts: 1


My Contributions
Hi every one,
Could anyone help me in Visual Basic 6
I have a project where I am using a text box connected to the database access through data control. To simplify the record search for the user I need to program the text box for the automatic record search by typing the first letter of any record.



User is offlineProfile CardPM
+Quote Post

KeyWiz
RE: Auto Filling Using Text Box In Visual Basic 6
3 Apr, 2007 - 07:07 PM
Post #2

D.I.C Regular
Group Icon

Joined: 26 Oct, 2006
Posts: 428


Dream Kudos: 125
My Contributions
Simple, under the TextBox_Change routine, recall the recordset based on the value currently held in the textbox.


User is offlineProfile CardPM
+Quote Post

kiss90
RE: Auto Filling Using Text Box In Visual Basic 6
29 Apr, 2007 - 11:28 AM
Post #3

New D.I.C Head
*

Joined: 29 Apr, 2007
Posts: 3


My Contributions
try this code

Name: AutoCompleter - Class Module
Description:This code allows you to have an autocomplete function on any text boxes by creating an instance of the class module below and setting a text control on a form to is CompleteTextbox property. Ideal for those situations when you have multiple autocompletes. (Visual Basic 6 Only - Can easily be modified for 5.0 users)
By: dmbbob


Inputs:
Dim m_objAutoCompleteUser as clsAutoComplete
Set m_objAutoCompleteUser = New clsAutoComplete
With m_objAutoCompleteUser
.SearchList = m_strUserList
Set .CompleteTextbox = txtUser
.Delimeter = ","
End With

Returns:None

Assumes:Create a new class module.
Paste all the code below into it.
Rename the module to clsAutoComplete.

Side Effects:None
This code is copyrighted and has limited warranties.
Please see http://www.Planet-Source-Code.com/xq/ASP/t...ts/ShowCode.htm
for details.
**************************************

Option Explicit
Private WithEvents m_txtComplete As TextBox
Private m_strDelimeter As String
Private m_strList As String
Private Sub m_txtComplete_KeyUp(KeyCode As Integer, Shift As Integer)

Dim i As Integer
Dim strSearchText As String
Dim intDelimented As Integer
Dim intLength As Integer
Dim varArray As Variant

With m_txtComplete
If KeyCode <> vbKeyBack And KeyCode > 48 Then
If InStr(1, m_strList, .Text, vbTextCompare) <> 0 Then
varArray = Split(m_strList, m_strDelimeter)

For i = 0 To UBound(varArray)
strSearchText = Trim(varArray(i))

If InStr(1, strSearchText, .Text, vbTextCompare) And
(Left$(.Text, 1) = Left$(strSearchText, 1)) And
.Text <> "" Then
.SelText = ""
.SelLength = 0
intLength = Len(.Text)
.Text = .Text & Right$(strSearchText, Len(strSearchText) - Len(.Text))
.SelStart = intLength
.SelLength = Len(.Text)
Exit Sub
End If

Next i
End If
End If
End With

End Sub
Public Property Get CompleteTextbox() As TextBox
Set CompleteTextbox = m_txtComplete
End Property
Public Property Set CompleteTextbox(ByRef txt As TextBox)
Set m_txtComplete = txt
End Property
Public Property Get SearchList() As String
SearchList = m_strList
End Property
Public Property Let SearchList(ByVal str As String)
m_strList = str
End Property
Public Property Get Delimeter() As String
Delimeter = m_strDelimeter
End Property
Public Property Let Delimeter(ByVal str As String)
m_strDelimeter = str
End Property


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 05:37PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month