473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

in vb.net how to assign a key to the combo box??

In VB6.0 in Combobox , you can use the ItemData to assign a key to the combo box like
With cbobox1

.AddItem "2D Bar"
.ItemData(ChartTypeComboBox.NewIndex) = VtChChartType2dBar

end with

in vb.net , i need to assign a key to the combo box how to do that ?

Thanks,
Jun 17 '08 #1
2 1276
Plater
7,872 Expert 4TB
A "key"? Like a keyboard key? A unique key in terms of like SQL?
Jun 17 '08 #2
mafaisal
142 100+
Hello

This is the code

Expand|Select|Wrap|Line Numbers
  1.         Dim Dst As New DataTable
  2.         StrSQL = "SELECT DispName,ID From Table"
  3.         Dap = New OleDb.OleDbDataAdapter(StrSQL, Con)
  4.         Dap.Fill(Dst)
  5.             With ComboBox1
  6.             .DataSource = Dst
  7.             .DisplayMember = DispName
  8.             .ValueMember = ID
  9.         End With
  10.  
In Here Combobox.Selected Value is the Key

Faisal
Jun 17 '08 #3

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

Similar topics

3
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
3
by: hmiller | last post by:
Hey everyone, I am having a hell of a time trying to set this menu system up. Here's what I'm trying to do. Combo Box One; is populated by names under properties "row source" "Phase 1"...
2
by: kiranmn75 | last post by:
I want to dynamically populate a combo box through javascript. Data is coming from a array. Sometimes data list may contain items in excess of 2000. Explorer takes more than 5 seconds to...
6
by: Andrew Robinson | last post by:
assuming that I have a class public class MyClass { public string FirstName { get {...} set {...} } } how can I assign the FirstName property using reflection on a generic class
1
by: Jeff Williams | last post by:
How di I dynamically build and 2 dimensional array and assign this array to a combobox. 1 item will be the displayed details and the other is the value I need returned.
4
by: philelpko | last post by:
Morning all, Not a clue why the hell this doesn't work so any help is most appreciated!! Using one form I allow the user to filter the records using combo boxes. Works fine, all the filtered...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
by: Akino877 | last post by:
Hello, I am new to HTML and PHP. And I am trying to assign an array of values to the <option value=...> of a combo list. But what I am trying to do is not working. I can sucessfully get it to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...
0
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,...
0
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...

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.