Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 27th, 2008, 02:24 AM
Registered User
 
Join Date: Jan 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Search for a String Match combo Box

Following up the Card Reader Problem (see its post) I would now like some help with a search function on a combo box list.

I have a combo box (cboMagnetic) connected (by code) to a MS Access Database.
It is bound by the following code:
.Datasource = dsDraft.Tables("PersonalData")
.Displaymember = "PersNumber"

The combo box nicely displays all Personal ID Numbers from the MS Access DB, and the BindingMangerBase.Position is hooked to the combobox.selectedIndex. A Personal ID displayed in the combobox would look like this: 9984839450 (as it appears in the database) All fine until here.

I have a text box called txtMagnetic and its text value is filled by a Magnetic Card Reader. The string in txtMagnetic.text looks like this after swiping a magnetic card: 003432875849984839450134785784
I have put the Magnetic Card reader string into a variable (magnetic) by declaring: magnetic = txtMagnetic.text
Please note that the listed Personal ID Number in the combo box can be found and matched inside variable magnetic.

QUESTION: I would like to do the following:
1. Have VB2005 match a Personal ID Number (from the ID's listed in the combo box) to variable: magnetic. Thus in other words VB2005 should find and match an ID number listed in the combobox) to the string that came from the Magnetic Card Reader and that was put into variable magnetic.

2. The result should change the current number listed in the Combo box and that (changing the selectedvalue of the combobox with another number - the one matched by the search) should move the bindingmanagebase.position automatically (which I think it does because the BindingMangerBase.Position is hooked to the combobox.selectedIndex) to the appropriate record in the database.

I have tried some MSDN solutions with FindString and FindExactString but they all error on me.
I declared a function:
    Public Function FindStringExact( _
    ByVal magnetic As String, _
    ByVal startIndex As Integer _
    ) As Integer
    End Function

And started the search by pressing a button that calls Private Sub Swiped Card:
    Private Sub SwipedCard()
        magnetic = txtMagnetic.Text
        'MessageBox.Show(magnetic)
        'this is to see if the card generated a number
        Dim instance As ComboBox
        Dim startIndex As Integer
        Dim returnValue As Integer
        returnValue = instance.FindStringExact(magnetic, startIndex)
    End Sub

Any help very Appreciated. And thank you in advance for taking the time to read all this.

- Tsadok






Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box to display items from parent combo box Gini Visual Studio 2008 0 June 18th, 2008 12:30 AM
Passing string to a text box in search engine rylemer Classic ASP Basics 0 October 26th, 2005 03:23 PM
Passing string to a text box in search engine rylemer ASP.NET 1.0 and 1.1 Professional 2 October 25th, 2005 06:11 PM
Search command button for combo box dinointheuk Other Programming Languages 1 October 6th, 2005 01:46 AM



All times are GMT -4. The time now is 10:03 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.