473,770 Members | 1,973 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 #1
14 5346
Gary,

They are highlighted because that the 0 index is the selected one initially.

Set the selectedindex to -1 of each after loading and that goes away.

I hope this helps?

Cor
Nov 21 '05 #2
Cor,

"Cor Ligthert" <no************ @planet.nl> schrieb:
They are highlighted because that the 0 index is the selected one
initially.


Nevertheless, the comboboxes should not remain highlighted if they don't
have the focus.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
But all five of them remain highlighted. I tried the suggestion Cor left
but that had no effect.

I'm at a lost to explain how five combo boxes could all appear to have
focus at the same time.

Gary
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:eJ******** ******@TK2MSFTN GP14.phx.gbl...
Cor,

"Cor Ligthert" <no************ @planet.nl> schrieb:
They are highlighted because that the 0 index is the selected one
initially.


Nevertheless, the comboboxes should not remain highlighted if they don't
have the focus.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
Thanks, I tried that with no effect. This is very strange.

Gary

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

They are highlighted because that the 0 index is the selected one initially.
Set the selectedindex to -1 of each after loading and that goes away.

I hope this helps?

Cor

Nov 21 '05 #5
Gary,

Can you explain this sentence a little more, I overreaded it focused on the
focus.
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 you have databind it to the database, than it should show the current
item in the database and not an item that you loaded. And is than a little
bit strange.

I have tried to simulate what you did, however cannot get your behaviour.

Cor
Nov 21 '05 #6
Gary,

Can you show how you bind them, just one is enough.

I ask you this because you are so definitly talking about binding while the
normal way is to set the datasource of the combobox to the table of the
dataset and than tell which displaymember (datafield) will be used.

When you do that and you use the index_change event from the comboboxes.
Than do you have to protect that it is firing in advance. The most used
method is a startupswitch (bool), which is set to true as soon as the
datasource and members of the comboboxes are set.

I hope this helps?

Cor
Nov 21 '05 #7
I only use a datasource and displaymember (and usually valuemember) if I
want the drop down list portion of the combo box to be populated from a
database, but that is not what I am doing in this instance at all so all
three of those are set to nothing.

As I have said, my drop down list is populated by way of the Items
collection in the VB.NET IDE. I just typed in the four possible allowed
values there. Under the databindings properties I have the text property
bound to my field in the database.

Here is the generated code from the form designer:

'cmbPartner
Me.cmbPartner.A nchor = CType(((System. Windows.Forms.A nchorStyles.Bot tom Or
System.Windows. Forms.AnchorSty les.Left) _Or
System.Windows. Forms.AnchorSty les.Right), System.Windows. Forms.AnchorSty les)
Me.cmbPartner.D ataBindings.Add (New System.Windows. Forms.Binding(" Text",
Me.datasetLocSc enario, "Scenario_to_Lo cation.PartnerT ype"))
Me.cmbPartner.I temHeight = 13
Me.cmbPartner.I tems.AddRange(N ew Object() {"", "Customer", "Supplier",
"Lead"})
Me.cmbPartner.L ocation = New System.Drawing. Point(568, 302)
Me.cmbPartner.N ame = "cmbPartner "
Me.cmbPartner.S ize = New System.Drawing. Size(176, 21)
Me.cmbPartner.T abIndex = 52

Gary

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:u0******** *****@TK2MSFTNG P09.phx.gbl...
Gary,

Can you show how you bind them, just one is enough.

I ask you this because you are so definitly talking about binding while the normal way is to set the datasource of the combobox to the table of the
dataset and than tell which displaymember (datafield) will be used.

When you do that and you use the index_change event from the comboboxes.
Than do you have to protect that it is firing in advance. The most used
method is a startupswitch (bool), which is set to true as soon as the
datasource and members of the comboboxes are set.

I hope this helps?

Cor

Nov 21 '05 #8
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 #9
I'm sorry Cor, but I just do not follow this second paragraph at all.

The code works as I expect it to. That is, the form displays with data from
my dataset. I can pick an item from the drop down list and the dataset is
updated.

Changing position of the dataset is outside the scope of this question. My
application uses a tree to pick what record is displayed on this form. When
I close the form the dataset changes (if any) are written back to the
database.
The user picks another item from the tree and a new instance of my form pops
up.

None of this is the issue, though. The issue remains, with this code all
the combo boxes are initially highlighted.

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 #10

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
1487
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
2928
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
10259
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
10101
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
10038
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
8933
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...
0
6710
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
5354
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...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.