473,569 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ComboBox Value

Hi,

I am trying to set the value of the a combobox with a
field from a dataset. It will not set.

Me.cboTypeDesc. Text = DsTitle.Tables( "Title").Rows(0 ).Item
("genre_descrip tion")

or

index = cboTypeDesc.Fin dStringExact(Ds Title.Tables
("Title").Rows( 0).Item("genre_ description"))
Me.cboGenre.Sel ectedIndex = index

Is there something wrong with the above? The combo box is
being filled via a datasource (displayMember, valueMember).

Any help would be great,
Thanks, Dianna

Jul 21 '05 #1
4 1519
Hi

Try using the SelectedItem property, although the code you write should be
working in my opinion.

You could set some breakpoints to check if the
DsTitle.Tables( "Title").Rows(0 ).Item("genre_d escription") has an expected
value that can be found in the cboTypeDesc.Dat aSource.

Jan

_______________ _______________ ____________
Read my weblog: http://weblogs.asp.net/jan

"Dianna K" <an*******@disc ussions.microso ft.com> wrote in message
news:0d******** *************** *****@phx.gbl.. .
Hi,

I am trying to set the value of the a combobox with a
field from a dataset. It will not set.

Me.cboTypeDesc. Text = DsTitle.Tables( "Title").Rows(0 ).Item
("genre_descrip tion")

or

index = cboTypeDesc.Fin dStringExact(Ds Title.Tables
("Title").Rows( 0).Item("genre_ description"))
Me.cboGenre.Sel ectedIndex = index

Is there something wrong with the above? The combo box is
being filled via a datasource (displayMember, valueMember).

Any help would be great,
Thanks, Dianna

Jul 21 '05 #2
I suspect the problem is in the tables value

combobox.text is just setting a text according to the
input (doesn't even check if the item is in the
combobox). So either the assigned value was "" (empty
string)
or your code didn't execute at all

Jul 21 '05 #3
Thank you for your help. It seems I was missing
the 'ToString' on my field value

DsTitle.Tables( "Title").Rows(0 ).Item
("genre_descrip tion").ToString

I knew it was something ridiculous.

Dianna

-----Original Message-----
Hi

Try using the SelectedItem property, although the code you write should beworking in my opinion.

You could set some breakpoints to check if the
DsTitle.Tables ("Title").Rows( 0).Item("genre_ description") has an expectedvalue that can be found in the cboTypeDesc.Dat aSource.

Jan

______________ _______________ _____________
Read my weblog: http://weblogs.asp.net/jan

"Dianna K" <an*******@disc ussions.microso ft.com> wrote in messagenews:0d******* *************** ******@phx.gbl. ..
Hi,

I am trying to set the value of the a combobox with a
field from a dataset. It will not set.

Me.cboTypeDesc. Text = DsTitle.Tables( "Title").Ro ws (0).Item ("genre_descrip tion")

or

index = cboTypeDesc.Fin dStringExact(Ds Title.Tables
("Title").Rows( 0).Item("genre_ description"))
Me.cboGenre.Sel ectedIndex = index

Is there something wrong with the above? The combo box is being filled via a datasource (displayMember, valueMember).
Any help would be great,
Thanks, Dianna

.

Jul 21 '05 #4
Thank you for your help. It seems I was missing
the 'ToString' on my field value

DsTitle.Tables( "Title").Rows(0 ).Item
("genre_descrip tion").ToString

I knew it was something ridiculous.

Dianna
-----Original Message-----
I suspect the problem is in the tables value

combobox.tex t is just setting a text according to the
input (doesn't even check if the item is in the
combobox). So either the assigned value was "" (empty
string)
or your code didn't execute at all

.

Jul 21 '05 #5

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

Similar topics

8
12072
by: Zlatko Matiæ | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
7
23522
by: NCrum | last post by:
I want to set the Default value of a Combobox for any changeable record and have got this working but it is totaly unsatisfactory see the code below I loop through the items in the Combo looking for a match between cVal and the selectedValue then stop when I do have a match the obvious problem is that each iteration fires the...
3
3019
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can download a fully working C# sample with the Northwind.mdb here: www.insightgis.com.au/web/stuff/DataGridCombo.zip
2
6183
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following criteria that I wanted to meet, but nothing did: - No reliance on a separate library - No unmanaged code - Easy subclassing of...
4
4606
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...
6
4895
by: Matt | last post by:
I'm not entirely sure how to describe this issue. I have a number of ComboBoxes in my application which have their text properties bound to a field in a data set. The items loaded in the ComboBox are not data bound (they just use the built in collection property of the ComboBox), and they are all set to use the DropDownList style. When moving...
6
2858
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox and the coresponding 'Id' from the lookup table is to be inserted into the field of the new record. I have two simple tables. "tblPerson" is the...
4
6650
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...
1
4222
by: Andrus | last post by:
I need to enter null value from combobox to business object property. My combobox datasource does not contain ValueMember with null value. So I tried to create combobox which stores null to bound object when text is deleted. However bound object contains old value in this case. To reproduce: 1. Run code
1
3525
by: Man4ish | last post by:
Hi, How Eventlistner can be used with rendred combo box. I got one example of combobox in table as follows . /* * Copyright (c) 1995 - 2008 Sun Microsystems, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are...
0
7924
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. ...
0
8125
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...
1
7676
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...
0
7974
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...
0
6284
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...
1
5513
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...
0
3653
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...
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
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...

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.