473,657 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dotnet Combox Datasource

13 New Member
how to read the valuemember of the combox whose data source is a detaset. i have assigned the properties of displaymember and valuemember . display member cis visible but i cant get the value member behind it..........
Sep 13 '07 #1
2 1241
dip_developer
648 Recognized Expert Contributor
how to read the valuemember of the combox whose data source is a detaset. i have assigned the properties of displaymember and valuemember . display member cis visible but i cant get the value member behind it..........
suppose customer_name is displaymember and customer_id is valuemember ...........
you can have it by..........

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim custid As String =CType(cmyCombo.SelectedValue,String)
  3.  
if valuemember is not set.....then you can have it by .........

Expand|Select|Wrap|Line Numbers
  1.  Dim custid As String = CType(myCombo.SelectedItem, DataRowView).Row("customer_id ")
Sep 13 '07 #2
Plater
7,872 Recognized Expert Expert
Sometimes (as is the case with a dataset)
the SelectedValue property returns an entire Row instead of just what is defined as the "valuemembe r".
You could check this by saying:
Expand|Select|Wrap|Line Numbers
  1. MessageBox.Show(mycombobox.SelectedValue.GetType().Name);
  2.  
That will tell you the name of the object it is returning, which frequently sheds some light on the problem.
Sep 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1059
by: raj | last post by:
Please Help with the combox DisplayValue property private void cboClient_SelectionChangeCommitted(object sender, System.EventArgs e) { String strSQL; strSQL = "SELECT F.FollowUpPerson FROM tblFollowUpPerson F INNER JOIN tblFollowUpPersonClient C ON F.FollowUpPersonID = C.FollowUpPersonID WHERE C.ClientKey = '" + this.cboClient.SelectedValue + "' "; ds = mg.GetDataSet(strSQL,"userList"); //Def is described at the end
4
1813
by: Charles A. Lackman | last post by:
Hello, I have a combox that I am trying to get to work in the following fashion. As you type in the combox that the item that matches what you are type is selected. as you type a last name: Leyman
2
1963
by: Alpha | last post by:
I have a window application. On one of the form, there is a listbox and a few combox. The lstSchItem has a dataview as a datasource. The comboxes are bind to its selected value but through the dataset table. Now when I change the selection in the lstSchItem the comboxes are staying the same and not reflecting the changes. I tried changing the binding to the dataview.table but the comboxes are still not changing to reflect the...
5
1287
by: Greg McKnight | last post by:
This may be the second time this post is showing, I accidentally shut down my browser. Sorry if it is a repeat. I am a newbie to VB.net, so please forgive me if these are simple questions. I'm using the Northwind DB to teach myself. I used the data form wizard to create a form with a dataset containing the 'Orders' and 'Order Detail' tables. The 'Orders' fields are displayed
2
2396
by: Daylor | last post by:
hi. i have 2 combobox on form. after i load the form. when i select the first combobox , i want to filter the datatable that attached to the second combobox. i wrote :
2
1321
by: Bob | last post by:
The scenario is that of the employees table wherein there's an EmployeeId and a ReportsTo field in the same table. The combobox is one in a datagrid view that lets you select an employee from the employees table to fill in the reportsto field, but since a person can't report to himself. I'm wondering how to exclude the EmployeeId of the selected record from the dropdown list of the combox. Ideally I think it would be to apply a filter to...
1
1318
by: neo1ra | last post by:
Hi, I'm doing a search combox to pop up and specific record. Everything is working fine until I make a change to the record that I'm working on and try to move to other record. A error message appear that said " Update or CancelUpdate without Addnew or Edit". I think that I need to add a message box that ask you if you want to save the record or not, but I don't know how to do it because I'm new in Access. Here is the code that I'm using...
1
1422
by: dewgan | last post by:
I have a form with a combox box where the list is populated via a linked table. This works fine. I have a text box that is filled with the name selected in the combox box. That name is then added to another table. That works fine. My problem is this, I want to keep the second table from being populated with the same name. So, for exampe, if I select the name John Smith in the Combo box but John Smith already exist in the second table, I...
0
2139
by: gyanendar | last post by:
Hi All, I am using DataGridview and there is a Combobox column is present in the datagrid. I am binding the DataGridViewComboboxcolumn with a DataSource. DataGridViewComboBoxColumn cmbInstType = (DataGridViewComboBoxColumn)grdCashMemoDetails.Columns; DataTable instType = new DataTable();
0
8392
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
8730
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
8503
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,...
1
6163
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
4151
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
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.