473,326 Members | 2,076 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,326 software developers and data experts.

Combobox question

Hi,

A simple question..
I have a datatable with 2 fields (SkuCode, ItemName)

I use a Combobox where the datasource is the DataTable and the DisplayMember
is the ItemName.
I add a TextBox where the user can type the SkuCode.
I would like to select the line in the ComboBox if the record exists.
I can not use the FindString method because the DisplayMember is not the
SkuCode.

Stan.
Nov 20 '05 #1
1 1048
Hi I try not to bind to datatables or dataviews directly

But this should work
Create a dataview based on the datatable
Bind the combobox to the dataview you should see all the items
then filter your dataview based on the text typed into the textbox

Else

This is what I do
Create a structure to contain the SkuCode and the DisplayMember
make the tostring return the DisplayMember
Add any enumirator etc you might want

Create a structure for each record and add it to a collection
then bind to the collection
you can then do something like this in say the textbox validated event

Dim t As Test = x(TextBox1.Text)

ComboBox1.SelectedItem = t

Assuming Test is the name of the structure and x is the name of the
collection
and you type a sku code in the textbox 1



"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
Hi,

A simple question..
I have a datatable with 2 fields (SkuCode, ItemName)

I use a Combobox where the datasource is the DataTable and the DisplayMember is the ItemName.
I add a TextBox where the user can type the SkuCode.
I would like to select the line in the ComboBox if the record exists.
I can not use the FindString method because the DisplayMember is not the
SkuCode.

Stan.

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Mr. B | last post by:
I've been seeking the solution to this. But can't figure it out (sounds simple enough). When you Populat a ComboBox, you can select the initial displayed items on startup simply by setting the...
6
by: Georges Heinesch | last post by:
An easy ComboBox question. ;) I would like to create a ComboBox, which permits to cycle through 3 subforms. These 3 subforms are entered in the ComboBox as Value List. The subforms should only...
7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
4
by: David Sworder | last post by:
Hi, I have a ComboBox that contains 1,400 sorted items . Here's the list: abba apple ... cabba caccaa capple
4
by: Beeeeeeeeeeeeves | last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with...
0
by: Hiroyuki Tanaka | last post by:
Hi All, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to...
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
6
by: Sakharam Phapale | last post by:
Hi All, How to fill one ComboBox from other ComboBox control? 1) Only setting the reference does the trick but doesn't show items in control. If you see in immediate window, it shows...
6
by: Hal Heinrich | last post by:
How do I implement the value equivalent of the ComboBox.FindStringExact method? I.e. How do I set the ComboBox.SelectedIndex so that the ComboBox.SelectedValue object matches one that I specify....
4
by: JJGarcia | last post by:
Hi Everyone, I'll try to explain the process I'm following, I'm new to this so I'm triying the easy way first, probably the lasyest too! I created a new Project, drag in to it a SQLConnection,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.