473,752 Members | 5,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bound combobox shows wrong item

My form uses a dataset containing two tables, a base table
(Contact) and a lookup table (Insurer). My combobox is
bound as follows:

DataSource = datasetContact
DisplayMember = Insurer.Insurer Name
ValueMember = Insurer.Insurer Id
DataBindings.Se lectedValue = Contact.Insurer Id

It generally works fine. I am able to navigate records and
it displays the correct bound item. I can even update data
using the combobox and save it to the database. But, there
is a bug! When I first fill the dataset, the combobox
displays the first item in the dropdown list rather than
the item it is bound to. When I navigate to another record
and navigate back to it, the correct item is displayed in
the combobox.

Am I missing something here? How do I get the combobox to
display the correct bound item after the fill?

Help would be greatly appreciated. Thanks, Phil
****
PS
****

I found "Hemang Shah" <he****@hemang. net> also asked this
question previously on 4th August and received no answer.
He said:

Hello Friends.

I have a form which is linked to a dataset of 3 tables.
One is the base table and the other 2 are look up tables.

Now when I scroll the records, the combo box i updated
properly showing the correct lookup.

But when I click update or load, the first item in the
combobox pops up even when that particular record dosen
thtat those selected..You know what I mean ?

I'm sure everyone would be having this problem and by now
there must b a well documented fix for this, can anyone
point me to the right direction ?
Thanks.
Jul 19 '05 #1
2 3450
Sounds like you need to call the event that snychronizes
the grids after you fill your second grid, i.e.

FillGrids
Call DataGrid1.Selec tedIndex_Change d()
-----Original Message-----
My form uses a dataset containing two tables, a base table(Contact) and a lookup table (Insurer). My combobox is
bound as follows:

DataSource = datasetContact
DisplayMembe r = Insurer.Insurer Name
ValueMember = Insurer.Insurer Id
DataBindings.S electedValue = Contact.Insurer Id

It generally works fine. I am able to navigate records andit displays the correct bound item. I can even update datausing the combobox and save it to the database. But, thereis a bug! When I first fill the dataset, the combobox
displays the first item in the dropdown list rather than
the item it is bound to. When I navigate to another recordand navigate back to it, the correct item is displayed in
the combobox.

Am I missing something here? How do I get the combobox to
display the correct bound item after the fill?

Help would be greatly appreciated. Thanks, Phil
****
PS
****

I found "Hemang Shah" <he****@hemang. net> also asked this
question previously on 4th August and received no answer.
He said:

Hello Friends.

I have a form which is linked to a dataset of 3 tables.
One is the base table and the other 2 are look up tables.

Now when I scroll the records, the combo box i updated
properly showing the correct lookup.

But when I click update or load, the first item in the
combobox pops up even when that particular record dosen
thtat those selected..You know what I mean ?

I'm sure everyone would be having this problem and by now
there must b a well documented fix for this, can anyone
point me to the right direction ?
Thanks.
.

Jul 19 '05 #2
Thanks for adding a comment Alex.

Could you please add extra explanation on how it applies
to a combobox (rather than a datagrid).

Thanks,

Phil
-----Original Message-----
Sounds like you need to call the event that snychronizes
the grids after you fill your second grid, i.e.

FillGrids
Call DataGrid1.Selec tedIndex_Change d()
-----Original Message-----
My form uses a dataset containing two tables, a base

table
(Contact) and a lookup table (Insurer). My combobox is
bound as follows:

DataSource = datasetContact
DisplayMemb er = Insurer.Insurer Name
ValueMember = Insurer.Insurer Id
DataBindings. SelectedValue = Contact.Insurer Id

It generally works fine. I am able to navigate records

and
it displays the correct bound item. I can even update

data
using the combobox and save it to the database. But,

there
is a bug! When I first fill the dataset, the combobox
displays the first item in the dropdown list rather than
the item it is bound to. When I navigate to another

record
and navigate back to it, the correct item is displayed inthe combobox.

Am I missing something here? How do I get the combobox todisplay the correct bound item after the fill?

Help would be greatly appreciated. Thanks, Phil
****
PS
****

I found "Hemang Shah" <he****@hemang. net> also asked thisquestion previously on 4th August and received no answer.He said:

Hello Friends.

I have a form which is linked to a dataset of 3 tables.
One is the base table and the other 2 are look up tables.

Now when I scroll the records, the combo box i updated
properly showing the correct lookup.

But when I click update or load, the first item in the
combobox pops up even when that particular record dosen
thtat those selected..You know what I mean ?

I'm sure everyone would be having this problem and by nowthere must b a well documented fix for this, can anyone
point me to the right direction ?
Thanks.
.

.

Jul 19 '05 #3

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

Similar topics

2
9597
by: bds | last post by:
I'm new to .net 2.0 and I'm trying to figure out the best way to create a form that has a couple of controls and one of the controls is a combo box with a data bound list of items from another table. To understand the problem more, consider using the AdventureWorks2000 database. I want a simple form that shows FirstName, LastName, and Shift. Instead of the ShiftID, I want the shift name from the Shift table to be displayed. Here's...
5
4664
by: Aaron Ackerman | last post by:
I have a bound combobox the appears on a cell within the column of my bound grid when the user clicks on a cell n(In my vb.net WinForm app). I am trying to allow the adding of an item to that bound combo by allowing the user to dynamically type in the new value directly in the combo box whcih in turn updates the lookup table and then when they have finished leaves that particular cell on the grid with the correct value. Seems...
2
1419
by: Don | last post by:
I've been trying to create a custom collection that can be bound to a combobox via the DataSource property, but I can't seem to get it to work. I've created a class that implements IList, and it seems to work okay on its own, but when I try to bind it to a combobox, the combobox doesn't show anything (and it starts having problems repainting itself). The Datasource appears to contain my custom collection object, but when I ask for its item...
4
4619
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...
4
309
by: Phil | last post by:
My form uses a dataset containing two tables, a base table (Contact) and a lookup table (Insurer). My combobox is bound as follows: DataSource = datasetContact DisplayMember = Insurer.InsurerName ValueMember = Insurer.InsurerId DataBindings.SelectedValue = Contact.InsurerId It generally works fine. I am able to navigate records and
2
1957
by: Crazy Cat | last post by:
I am using a data-bound combobox with dropdownstyle set to dropdownlist. Teh combobox is bound to a bindingsource which is in turn bound to a table in my database. The table has only 4 rows and I am using it to display geographical regions - Northeast, Southeast, West, and Central. In the bindingsource AddNew is set to false. Whenever I select an item from the combobox I find that the position in the dropdown list is replaced by the...
0
2017
by: Frnak McKenney | last post by:
Can I use a bound ComboBox for both browsing and editing? I'm working on a small, standalone database application using Visual C#.NET 2003 and an Access data file. In order to keep the number of different screens down to a minimum, I'm trying to use the same Windows Forms for both browsing and for updating. This works fine for TextBoxes, but I'm running into problems with my DropDownLists (ComboBoxes).
4
6666
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a common/standard .NET control accepting an Object as a parameter type? In Web Forms, there is a ListItem object that can be passed in to add/retrieve objects from a DropDownItems collection. I searched Google groups, and all the solutions I'm finding...
1
1767
by: Robert Dufour | last post by:
I have a table of addresses and it contains a CountryId which points to a table of countries. The datatstructure of the Countries Lookup tables is actually created from three tables - a CountryIdtable - a Countries localized tables and an cultures tables From which I extract a dataset select CountryID - CountryName - Culture name (with inner joins between the three) where CultureName = CurrentCulture.CurrentUiCulture.tostring. So I would...
0
9072
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
9451
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
9421
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
9333
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...
1
6869
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
6151
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
4771
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
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2872
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.