473,785 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combo boxes initially highlighted

I have five comboboxes each has a item listed populated by hand in the IDE.
Each has the text property bound to a text field in the database. When I
initially fill the dataset and display the page all of these combo boxes
display the correct data, but all of them are highlighted as if they have
focus.

If I click in on and then click another control the highlight goes away. I
have a tabbed interface and If I navigate to another tab and back the
highlights are gone from all of the combo boxes.

How can I get them to initially display the data not highlighted?

Gary
Nov 21 '05
14 5347
Well I think I finally found it. But I don't understand it! <big ol' grin>

I did a test where I removed the items collection from one of the
comboboxes. Then it still correctly displayed the data from my dataset, the
list portion of the combo box was empty as expected, but the text was not
highlighted!

I wondered if what I was seeing was an indication that the control was
telling me when it found a match between the dataset data shown and an item
in the list portion. To test that further, I replaced the items collection
but removed ONE item. Displaying various records in my database proved my
theory. Any time the data displayed had a matching item in the collection
the text was highlighted. Any time there was no match the text was not
highlighted.

I then realized that since I wanted to limit the user to pick ONLY from an
item in the collection, I should change the DropDownStyle property from
DropDown to DropDownList. When I did this and added the removed item back
to the collection, none of the displayed records produced a highlighted text
result!

This certainly is strange behavior though, I didn't try it here, but I am
pretty sure from other projects that if I had bound the datasource to a
table and set the displaymember, that a displayed record with a match in the
dataset bound item collection would NOT have resulted in highlighted text
even with the DropDownStyle set to the default DropDown value.

Gary
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:us******** ******@tk2msftn gp13.phx.gbl...
Gary,

It was the code I expected (exactly as you described) however what would it do in your opinion.
(And therefore I asked you to show it, because I could misunderstand you).

The databinding is to set the text from the dataadapter field to the same
text in the combobox as is the currentposition in the datatable to what it
is binded. However that dataset has now in my opinion no way to change its
position.

What is your purpose now?

Cor

Nov 21 '05 #11
Gary,

I have fight myself often with the combobox. In my (and I have seen in this
newsgroup not only my) opinion is it the most buggy control there is.

The expirience that you describe now, did I have as well. However I am still
not see how you bind it (It is not interesting to describe it, when you
found your solution it is OK).

Maybe is there something happening I never thought about, although I have
expirienced a lot with that combobox in the same way as you are doing now.

I am glad you are finding the solution.

Cor
Nov 21 '05 #12
I do want to continue the discussion, even if I did find a solution, because
at some point it might be necessary to allow the user to enter an item not
in the item collection. In that case the DropDownStyle would HAVE to be
DropDown not DropDownList. And then I'm back to highlighted entries.

Here is the binding:

Me.cmbPartner.D ataBindings.Add (New System.Windows. Forms.Binding(" Text",
Me.datasetLocSc enario, "Scenario_to_Lo cation.PartnerT ype"))

Nothing fancy. Very straight forward.

I am not sure though if maybe the combobox is supposed to highlight the text
IF there is a match between the text portion and an item in the item
collection (the list portion of the combo). That may just be the intended
behavior. I say this because I do have another combo box on this same page,
it does have it's DataSource pointing to a dataset and uses the
DisplayMemeber and ValueMember. That one has a databinding from the forms
main dataset to the SelectedValue property. It has the same behavior when
its DropDownStyle is set to DropDown. The text is initially highlighted.
Setting that property to DropDownList and the highlight is gone.

Gary

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:u4******** ******@TK2MSFTN GP15.phx.gbl...
Gary,

I have fight myself often with the combobox. In my (and I have seen in this newsgroup not only my) opinion is it the most buggy control there is.

The expirience that you describe now, did I have as well. However I am still not see how you bind it (It is not interesting to describe it, when you
found your solution it is OK).

Maybe is there something happening I never thought about, although I have
expirienced a lot with that combobox in the same way as you are doing now.

I am glad you are finding the solution.

Cor

Nov 21 '05 #13
Gary,

What I did to test your behaviour was making a small test program.

Maybe can you look at that and change what is in your situation not the same
and try to get the behaviour you have, than we know both what it is.
(I did not change the style of the combobox yet in this)

\\\needs only 3 comboboxes on a form
Private Sub Form1_Load(ByVa l sender As _
System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Dim dt As New DataTable
Me.ComboBox1.It ems.AddRange(Ne w Object() _
{"1", "2", "3", "4", "5", "6"})
Me.ComboBox2.It ems.AddRange(Ne w Object() _
{"1", "2", "3", "4", "5", "6"})
Me.ComboBox3.It ems.AddRange(Ne w Object() _
{"1", "2", "3", "4", "5", "6"})
dt.Columns.Add( "Num")
For i As Integer = 0 To 5
dt.Rows.Add(dt. NewRow())
dt.Rows(i)(0) = (i + 1).ToString
Next
BindingContext( dt).Position = 1
ComboBox1.DataB indings.Add("Te xt", dt, "Num")
ComboBox2.DataB indings.Add("Te xt", dt, "Num")
ComboBox3.DataB indings.Add("Te xt", dt, "Num")
End Sub
///
Nov 21 '05 #14
I loaded your code and of course it doesn't have the same behavior as mine.
<grin> or maybe it should be <sigh>

Now the question I have to answer myself is "what's different?".

I'll try to do that over the next few days but since the app is now working
with the other dropdown style and deadlines are looming close, it will have
to take a lower priority.

Thanks for you help. This is truly baffling, frustrating and highly
interesting all at the same time!

Gary

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Gary,

What I did to test your behaviour was making a small test program.

Maybe can you look at that and change what is in your situation not the same and try to get the behaviour you have, than we know both what it is.
(I did not change the style of the combobox yet in this)

\\\needs only 3 comboboxes on a form
Private Sub Form1_Load(ByVa l sender As _
System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Dim dt As New DataTable
Me.ComboBox1.It ems.AddRange(Ne w Object() _
{"1", "2", "3", "4", "5", "6"})
Me.ComboBox2.It ems.AddRange(Ne w Object() _
{"1", "2", "3", "4", "5", "6"})
Me.ComboBox3.It ems.AddRange(Ne w Object() _
{"1", "2", "3", "4", "5", "6"})
dt.Columns.Add( "Num")
For i As Integer = 0 To 5
dt.Rows.Add(dt. NewRow())
dt.Rows(i)(0) = (i + 1).ToString
Next
BindingContext( dt).Position = 1
ComboBox1.DataB indings.Add("Te xt", dt, "Num")
ComboBox2.DataB indings.Add("Te xt", dt, "Num")
ComboBox3.DataB indings.Add("Te xt", dt, "Num")
End Sub
///

Nov 21 '05 #15

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

Similar topics

0
2390
by: Andrew | last post by:
Hello, I am trying to create a chart whose underlying query is linked to 2 combo boxes on the same form. I want to pass the values from the combo boxes into the chart query to allow the chart data to be manipulated easily. The combo box uses "Row Source Type" = Table/Query. The "Row Source" references a query to extract a distinct list of data.
1
2134
by: Hank | last post by:
On various forms I have combo boxes with preloaded selections. I click the down arrow to display the choices. On some of the boxes, if I type the first letter of the selection (Lets say "C") then the first "C" choice is highlighted and the drop down is still active, allowing me to click the one I really want: ("Charlie" and not "Carl"). On other boxes, the first selection is hightlighted and the drop down is set inactive leaving me with...
4
1548
by: Don Sealer | last post by:
I have a form that is based on a table called CVA Defects Table. Three of the fields in the table and form are Oil line defects, Gas line defects, and Sub assembly defects. These fields use lookups into another table called "defects table". If I input from the CVA Defects Table everything works fine all the time. However when I input data from the form I have problems. The Oil & Gas line lookups work very well all the time in the form....
1
1488
by: Jack | last post by:
Hello, On a form, I have a tab control with two tab pages. On one tab page, I have about seven group boxes which I hide and make visible when buttons are clicked on the tab page. No problems there. In one of these group boxes, I have a few combo boxes, however some of them are 'highlighted' for some reason when the groupbox is made visible. They're NOT selected nor have focus!. When the user tabs to, or selects then moves away from...
0
2929
by: Jeremy Wallace | last post by:
Folks, Here's a write-up I did for our developer wiki. I don't know if the whole rest of the world has already figured out how to do this, but I hadn't ever seen it implemented, and had spent a lot of time trying to figure it out, over the years. It finally dawned on me a couple of weeks ago how to do this. A couple of notes: 1) This is written for a different audience than CDMA; it's written for
0
1603
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number of text and combo boxes on it (in panels on the tab). These combos were originally simple drop down lists - i.e. you had to select from the list and couldn't enter anything of your own. At that time everything worked fine. Now, the users...
3
1095
by: mvenkatesan | last post by:
hi in my project is search site within combox boxes(3) it related to eachother initially select one combo and it fire the next combo and last fire the listout the items. initially i put the data on the 1st combo, it selected but 2nd combo not list. on this used jscript code how is it fire the 1st combo?
1
1630
by: John Kreps | last post by:
I've tried to get combo boxes to work with Access 2007 for days now without success. What I can't get to work is the autocomplete. I've got three simple tables and one form with two controls. Initially, the autocomplete works. However, after exiting and restarting access, the autocomplete stops. If I type in a valid record/entry, access says item not in list. But, I can select the same record/entry in the drop down without getting an...
11
3059
by: jgoodnight | last post by:
Hi, I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo box to list only those factors that are part of the selected sub-area. For example, if I select area 1.0, the Sub-Area combo box displays 1.1, 1.2, and 1.3 as options. It does not show 2.1, 3.1, etc. If I select area 2.0, the Sub-Area combo box...
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9489
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
10356
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9959
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
6744
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
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
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.