473,416 Members | 1,548 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,416 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 2136
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
0
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...

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.