By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,558 Members | 1,699 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,558 IT Pros & Developers. It's quick & easy.

Transpose datagrid row to corresponding label text

P: n/a
I have a datagrid containing data from an xml file. Is it possible that when
a row on the datagrid is clicked these results can update a series of
corresponding labels elsewhere on the form? e.g. the datagrid contains the
columns, FirstName and LastName. When a row is highlighted I'd like the
selected FirstName and LastName to appear in labels at the top of the form.
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

If you bind the datagrid and the labels to the same data source
the currency manger will keep them in sync. Here is an example.

Dim strConn As String

Dim strSQL As String

Dim da As OleDbDataAdapter

Dim ds As New DataSet
Dim conn As OleDbConnection

strConn = "Provider = Microsoft.Jet.OLEDB.4.0;"

strConn &= "Data Source = Northwind.mdb;"

conn = New OleDbConnection(strConn)

da = New OleDbDataAdapter("Select * From Categories", conn)

da.Fill(ds, "Categories")

daEmployees = New OleDbDataAdapter("Select * From Employees Order by
LastName, FirstName", conn)

daEmployees.Fill(ds, "Employees")

DataGrid1.DataSource = ds.Tables("Categories")

TextBox1.DataBindings.Add("Text", ds.Tables("Categories"), "Description")

Ken

-----------------

"lukegregory" <lu*********@discussions.microsoft.com> wrote in message
news:56**********************************@microsof t.com...
I have a datagrid containing data from an xml file. Is it possible that when
a row on the datagrid is clicked these results can update a series of
corresponding labels elsewhere on the form? e.g. the datagrid contains the
columns, FirstName and LastName. When a row is highlighted I'd like the
selected FirstName and LastName to appear in labels at the top of the form.
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.