473,320 Members | 1,976 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,320 software developers and data experts.

Getting content from one column in a datagrid in a textbox

I have a datagrid with columns. One of the columns are a textbox.
I want the text in this column shown in a textbox outside the datagrid.
How can I do that when clicking the actual row in the datagrid?
reidarT
Sep 4 '06 #1
3 1715
For .NET 1.x or 2.0?

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"reidarT" <re****@eivon.nowrote in message
news:Ol***************@TK2MSFTNGP03.phx.gbl...
>I have a datagrid with columns. One of the columns are a textbox.
I want the text in this column shown in a textbox outside the datagrid.
How can I do that when clicking the actual row in the datagrid?
reidarT

Sep 4 '06 #2
for .net 2.0
reidarT
"Mike McIntyre" <mi****@getdotnetcode.comskrev i melding
news:%2****************@TK2MSFTNGP06.phx.gbl...
For .NET 1.x or 2.0?

--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"reidarT" <re****@eivon.nowrote in message
news:Ol***************@TK2MSFTNGP03.phx.gbl...
>>I have a datagrid with columns. One of the columns are a textbox.
I want the text in this column shown in a textbox outside the datagrid.
How can I do that when clicking the actual row in the datagrid?
reidarT


Sep 4 '06 #3
You can bind the Text property of your 'off the grid' TextBox to your
DataGridView's BindingSource text column and the TextBox will display the
text for the row selected in the DataGridView.

..1 At design time you can select the TextBox that is outside the
DataGridView, view its properties, select DataBindings -Advanced to open
the 'Formatting and Advanced Binding' dialog where you can associate the
column of the BindingSource with the TextBox.

OR

2. For runtime binding you will need to add code similar to this to bind the
TextBox Text property to the BindingSource:
Me.TextBox1.DataBindings.Add(New System.Windows.Forms.Binding("Text",
Me.CustomerBindingSource, "Name", True))

The example above shows the Text property of a TextBox named TextBox1 being
bound to the "Name" column of a BindingSource named CustomerBindingSource.
--
Mike

Mike McIntyre [MVP]
http://www.getdotnetcode.com
"reidarT" <re****@eivon.nowrote in message
news:Ol***************@TK2MSFTNGP03.phx.gbl...
>I have a datagrid with columns. One of the columns are a textbox.
I want the text in this column shown in a textbox outside the datagrid.
How can I do that when clicking the actual row in the datagrid?
reidarT

Sep 4 '06 #4

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

Similar topics

3
by: Billy Jacobs | last post by:
I have created a DataGridColumnDatePicker Component so that I can put a datetimepicker control in my datagrid. It almost works. When I put my mouse in the cell it changes to a datetimepicker...
0
by: Andrea Trevisan | last post by:
That's a revival of a known thing I suppose.I hope it's useful. My problem was: I want to have a DataGrid with two Template columns: first with TextBox,second with Button.I want to fire an event...
4
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the...
3
by: ALPO | last post by:
We have a datagrid built using template columns. Many are text boxes. These text boxes are bound to a datasource as follows: <ItemTemplate> <asp:TextBox id="txtPeriod1" runat="server"...
2
by: Colin McGuigan | last post by:
This is a translation of an ASP page to ASP.Net. First, the background: The goal is to have a grid of different settings for the application -- think something along the lines of the Property...
2
by: Alex | last post by:
Hi all, I'm writing a small web application which searches a database based on a date field, and populates a datagrid control with the results. The datagrid control has selection buttons added...
1
by: Luis Esteban Valencia | last post by:
Hello. I have a datagird with textboxes on a column item template, I also have 2 other columns that are hidden and I want to retrieve his value. But I havent found how to do it. Thanks very much...
1
by: headbig003 | last post by:
Hello I put template column in datagrid. Below is the html code I used. <asp:datagrid id="dgAnswer" runat="server" Width="360px" AutoGenerateColumns="False" DataKeyField="ansID"> <Columns>...
6
by: Agnes | last post by:
I understand it is impossible, but still curious to know "Can I freeze several column in the datagrid, the user can only scroll the first 3 columns (not verical), for the rest of the coulumn, it is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.