473,698 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to implement ComboBox.FindVa lue

How do I implement the value equivalent of the ComboBox.FindSt ringExact
method?

I.e. How do I set the ComboBox.Select edIndex so that the
ComboBox.Select edValue object matches one that I specify.

Thanks in advance for any help,
Hal Heinrich
VP Technology
Aralan Solutions Inc.
Nov 21 '05 #1
6 10582
combobox.Select edIndex = combobox.FindSt ringExact(mystr ing)

"Hal Heinrich" wrote:
How do I implement the value equivalent of the ComboBox.FindSt ringExact
method?

I.e. How do I set the ComboBox.Select edIndex so that the
ComboBox.Select edValue object matches one that I specify.

Thanks in advance for any help,
Hal Heinrich
VP Technology
Aralan Solutions Inc.

Nov 21 '05 #2
Dennis,

You do not understand the question! It is not how use FindStringExact , which
works with the ComboBox.Displa yMember.

The question is how to find the index corresponding to a specific
ComboBox.ValueM ember.

Hal

"Dennis" wrote:
combobox.Select edIndex = combobox.FindSt ringExact(mystr ing)

"Hal Heinrich" wrote:
How do I implement the value equivalent of the ComboBox.FindSt ringExact
method?

I.e. How do I set the ComboBox.Select edIndex so that the
ComboBox.Select edValue object matches one that I specify.

Thanks in advance for any help,
Hal Heinrich
VP Technology
Aralan Solutions Inc.

Nov 21 '05 #3
Hal,

When I had not read your answer to Dennis I would have given the same answer
as he.

Therefore it is true that probably Dennis did not understand your question,
probably because of the way the question was asked.

The answer is simple, use a dataview (or defaultview) as datasource and use
a dataview.find to find the rowindex. That you can set to your
selectedindex.

http://msdn.microsoft.com/library/de...findtopic1.asp

I hope this helps?

Cor
Nov 21 '05 #4
Cor,

Thanks for your reply. I'd like to rephrase the question as follows:

Can you provide an implementation for the following function definition?

Public Function FindValue(ByVal cb As System.Windows. Forms.ComboBox,
ByVal obj As Object) As Integer
'Parameters
' cb
' the ComboBox to be searched
' obj
' the Object to search for
'
'Return Value
' The zero-based index of the first item found; returns -1 if no
match is found.
'
'Remarks
' Uses the Equals method of the Object class to determine a match
' returns the index for which the following is true:
' obj.Equals(cb.S electedItem)
'
End Function

Thanks,
Hal

"Cor Ligthert" wrote:
Hal,

When I had not read your answer to Dennis I would have given the same answer
as he.

Therefore it is true that probably Dennis did not understand your question,
probably because of the way the question was asked.

The answer is simple, use a dataview (or defaultview) as datasource and use
a dataview.find to find the rowindex. That you can set to your
selectedindex.

http://msdn.microsoft.com/library/de...findtopic1.asp

I hope this helps?

Cor

Nov 21 '05 #5
if cb.items.contai ns(obj) then
return cb.items.indexO f( obj)
else
return -1
end if

Does this work for you ?
http://msdn.microsoft.com/library/de...dexoftopic.asp

HTH
rawCoder

"Hal Heinrich" <Ha*********@di scussions.micro soft.com> wrote in message
news:8A******** *************** ***********@mic rosoft.com...
Cor,

Thanks for your reply. I'd like to rephrase the question as follows:

Can you provide an implementation for the following function definition?

Public Function FindValue(ByVal cb As System.Windows. Forms.ComboBox,
ByVal obj As Object) As Integer
'Parameters
' cb
' the ComboBox to be searched
' obj
' the Object to search for
'
'Return Value
' The zero-based index of the first item found; returns -1 if no
match is found.
'
'Remarks
' Uses the Equals method of the Object class to determine a match ' returns the index for which the following is true:
' obj.Equals(cb.S electedItem)
'
End Function

Thanks,
Hal

"Cor Ligthert" wrote:
Hal,

When I had not read your answer to Dennis I would have given the same answer as he.

Therefore it is true that probably Dennis did not understand your question, probably because of the way the question was asked.

The answer is simple, use a dataview (or defaultview) as datasource and use a dataview.find to find the rowindex. That you can set to your
selectedindex.

http://msdn.microsoft.com/library/de...findtopic1.asp
I hope this helps?

Cor

Nov 21 '05 #6
Thank you!

That is exactly what I was after.

Hal

"rawCoder" wrote:
if cb.items.contai ns(obj) then
return cb.items.indexO f( obj)
else
return -1
end if

Does this work for you ?
http://msdn.microsoft.com/library/de...dexoftopic.asp

HTH
rawCoder

"Hal Heinrich" <Ha*********@di scussions.micro soft.com> wrote in message
news:8A******** *************** ***********@mic rosoft.com...
Cor,

Thanks for your reply. I'd like to rephrase the question as follows:

Can you provide an implementation for the following function definition?

Public Function FindValue(ByVal cb As System.Windows. Forms.ComboBox,
ByVal obj As Object) As Integer
'Parameters
' cb
' the ComboBox to be searched
' obj
' the Object to search for
'
'Return Value
' The zero-based index of the first item found; returns -1 if no
match is found.
'
'Remarks
' Uses the Equals method of the Object class to determine a

match
' returns the index for which the following is true:
' obj.Equals(cb.S electedItem)
'
End Function

Thanks,
Hal

"Cor Ligthert" wrote:
Hal,

When I had not read your answer to Dennis I would have given the same answer as he.

Therefore it is true that probably Dennis did not understand your question, probably because of the way the question was asked.

The answer is simple, use a dataview (or defaultview) as datasource and use a dataview.find to find the rowindex. That you can set to your
selectedindex.

http://msdn.microsoft.com/library/de...findtopic1.asp
I hope this helps?

Cor


Nov 21 '05 #7

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

Similar topics

9
3925
by: Programatix | last post by:
Hi, I'm having problem with ComboBox. I'm trying to force the ComboBox select nothing by doing this, myCombo.SelectedText = "" myCombo.SelectedIndex = -1 but in vain, as the ComboBox will automatically select the first available selection. If I make the ComboBox visible before setting the .SelectedText to "" and
1
11361
by: Ed Stewart | last post by:
Hello. I'm creating an application that requires user input into a ComboBox, and I'd like to have the cursor appear in this emtpy ComboBox when the application starts. I had a plain TextBox, and the cursor started there automatically; to implement a history feature, I've moved to a ComboBox, but now the user needs to click on it before typing. How do I set focus on this item? I've tried adding a null string and calling comboBox.Focus()...
2
10635
by: VM | last post by:
How can I implement the autocomplete functionality in a Windows comboBox? Thanks.
0
1210
by: Michael C# | last post by:
I have found a few samples of using a combobox in a Datagrid on the Web (Windows Forms). While these examples work well for what they do, I need more functionality, and I'd like some advice on the best way to implement it (if it hasn't already been implemented, that is)... Here's my situation: -I have an ArrayList of Items that need to be bound to the combobox. The ArrayList contains data like this:
4
4615
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
17
2252
by: ApexData | last post by:
Hello I have a single form, and want to require the user to make a selection from a serialnumber ComboBox before being allowed to enter any other textboxes. Also, the user should be allowed to click on an Exit button I created and get a response. The following code works fine without the ExitButton issue: Private Sub SerialCombo_Exit(Cancel As Integer)
2
8665
by: shumaker | last post by:
I have a combobox that is very much like the one found in the RSS project here: http://msdn.microsoft.com/vstudio/express/visualCSharp/learning/ My projectNameComboBox basically is filled with a list of values from a table, and as the user selects values, a datagrid displays related records from another table because it is bound via FK relationship. My table: /****** Object: Table . Script Date: 06/19/2006
5
5906
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique CompanyID's. The second combobox will contain unique memberID's. Each of the tables that I have to search contain a CompanyID and a memberID field, and these fields are not unique in the respective tables. Like CompanyID, MemberID
1
3537
by: Man4ish | last post by:
Hi, How Eventlistner can be used with rendred combo box. I got one example of combobox in table as follows . /* * Copyright (c) 1995 - 2008 Sun Microsystems, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met:
0
8608
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9029
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8898
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.