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

Databinding a combo box

I'm observing some strange behavior when I use a bound combo box in conjunction with
the combo's anchor property. I define a form which contains just a textbox and a
combo box. The text box is placed before the combo in taborder, and is there only so
the focus will go someplace other than the combo box when the form is displayed.

In the form load event, I have the following code to create an arraylist and bind the
combo to it:

Dim a As ArrayList = New ArrayList

For i As Integer = 1 To 20
a.Add("Test Line " & i)
Next

ComboBox1.DataSource = a

When the form is displayed, the first item in the combo box's list is displayed in
the combo's associated textbox. If you set the combo's anchor property to any other
value than "Top, Left", the combo's text is displayed and also selected, even though
the combo does not have the focus.

If I load the combo "by hand", manually adding the above strings to the combo's Items
collection, no item is selected when the form is displayed, regardless of the anchor
property.

Anybody have any idea why the combo would choose to select text with any anchor value
other than "top, left" but not select it if it is "top, left"? Ad what does the
anchor property have to do with this, anyway?

I realize I can set the combo's SelectedIndex value to -1 after setting the
datasource, but I believe the behavior I am observing is inconsistent. Is this a bug
or is there something I don't understand?
Nov 20 '05 #1
2 2135
Hi Jeff,

Most of us stopped looking at strange behaviour in the initialization fase
of the combobox.

However preventing the selectedindexchange to start, with a bool/switch/flag
which you set to true at the end of your load, will mostly overcome most
problems (not all).

I hope it helps anyway?

Cor
Nov 20 '05 #2
Hi Jeff,

Most of us stopped looking at strange behaviour in the initialization fase
of the combobox.

However preventing the selectedindexchange to start, with a bool/switch/flag
which you set to true at the end of your load, will mostly overcome most
problems (not all).

I hope it helps anyway?

Cor
Nov 20 '05 #3

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

Similar topics

0
by: CGuy | last post by:
URGENT HELP REQUIRED FROM GURUS Hi, I have a custom object that implements ICollection and IListSource. This object has also an enumerator defined for it which implements IEnumerator and...
2
by: Cecilio | last post by:
Hi. I want to know hi i can show a combo without any text value, after y make a databinding with it. Thanks
1
by: ZZZ | last post by:
I have several combo's with databinding values. when a user starts typen, it's autocompleting so far so good but i don't want the user to have the ability to type a values that's not in the...
3
by: Lloyd Sheen | last post by:
I have several apps that use a roll your own approach, but I am embarking on a project which will not allow that with the time constraints. I have gened up a little app to try the databinding...
0
by: Jeff Mason | last post by:
I'm observing some strange behavior when I use a bound combo box in conjunction with the combo's anchor property. I define a form which contains just a textbox and a combo box. The text box is...
1
by: Gary Shell | last post by:
I have a pair of combo boxes on a form. Both have their SelectedValue property bound to a column on a table called "Input_Output". One column is called "Class" and the second is called "SubClass"....
0
by: Michael | last post by:
Hi everyone, I'm working on cutting down code in a form I'm working on, and decided to bind the controls to a dataset. I have two problems now. I have a couple datasets that I'm binding to. 1. I...
5
by: Dennis | last post by:
I am trying to create a form using databinding to a dataset and one of the fields requires the user to select from a list of optons. Any hints on how to do this other than bind the field to a...
0
by: aine_canby | last post by:
Hi, I'm trying to master databinding but I feel like I'm doing it all wrong. I have a combo which allows me to select a test. I also have the ability to add a test which should result in its...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
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...
0
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,...

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.