473,508 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Quick Question

Hi Group,

I wonder if somebody would be kind enough to explain something to me or even
point me in the direction of a link?

What is the difference on a combobox's databinding between:

SelectedItem, SelectedValue, Tag, Text, Datasource, & Displaymember.

The Reason I ask is I have 2 x Table, Table 1 has a feild called
AceessLevel, Table 2 has a list of access levels, I would like to be able to
use a combo box to select the Acesslkevel and update the database.

Many Thanks
Merlin
Nov 20 '05 #1
2 804
There is a sample for you

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
Debug.WriteLine(Me.ComboBox1.Text & " " & Me.ComboBox1.SelectedValue
End Su

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa

Dim arrPerson As New ArrayList(

arrPerson.Add(New Person("操作员1", "11")
arrPerson.Add(New Person("操作员2", "22")
arrPerson.Add(New Person("操作员3", "33")
arrPerson.Add(New Person("操作员4", "44")

Me.ComboBox1.DataSource = arrPerso
Me.ComboBox1.DisplayMember = "Name
Me.ComboBox1.ValueMember = "ID

Me.DataGrid1.DataSource = arrPerso
End Su

Public Class Perso

Private _Name As Strin
Private _ID As Strin

Public Sub New(ByVal strName As String, ByVal strID As String
MyBase.New(
Me._Name = strNam
Me._ID = strI
End Su

Public ReadOnly Property Name() As Strin
Ge
Return _Nam
End Ge
End Propert

Public ReadOnly Property ID() As Strin
Ge
Return _I
End Ge
End Propert

End Class
Nov 20 '05 #2
Cor
Hi,

Merlin in addition to TomYao a short explanation.

SelectedItem,

The selected displaymember item (see below)

SelectedValue,
The selected valuemember item

Tag,
To save some data in the combobox (I never used it)

Text,
The current text in the textbox from the combobox

Datasource,
The source from the data mostly a datatable (as a part of a dataset) or an
array

Displaymember
The column of the datatable to show

Valuemember
The column of the datatable to pick as value

I hope this helps?

Cor
..


Nov 20 '05 #3

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

Similar topics

0
7226
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,...
0
7388
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...
0
7499
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
5631
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 projectplanning, coding, testing,...
0
4709
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...
0
3199
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...
0
1561
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 ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
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...

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.