Re: Cell Contents ...Almost

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Arne,

If you read Add in Net you can be surethat it is about a collection.

Therefore you are adding everytime a binding at every click.
The way you solve that is up to you, either outside your method, using a
test if the collection is more than 1, or use a static boolean. (I prefer
the first one).

Secondly don't forget to do a bidingsource EndEdit (version 2.0) or a
currencymanager EndCurrentEdit (version 1.1), to push the data down at the
click event, this is only done automaticly at a row change, but that is not
with a textbox.

I hope this helps a little bit.

Cor

"Arne Beruldsen" <ArneBeruldsen@xxxxxxxxxxxxxxxxxxxxxxxxx> schreef in
bericht news:15CF9995-E7B6-4B75-A006-7586A89F6278@xxxxxxxxxxxxxxxx
Robin...

I added this line of code at the Cell Click Event...

TextEdit11.DataBindings.Add("Text", SxTable, "LastName", True)

Two problems...
1. It takes the "LastName" from the first record and not from the cell
selected
2. If I hit another cell....I get this error message "This causes two
bindings in the collection to bind to the same property."

Thanks for your help...

Arne

"RobinS" wrote:

If you are populating the textbox with the same columns all the time,
you can bind your datagrid to a BindingSource, then bind the
BindingSource to the DataSet.

Then you can bind the textbox to the same BindingSource. I
believe if you do this, when you pick an entry in the grid, it will
automatically update the textbox with the value in that row.

Dim nwData as CustomersDataSet = CustomersDataSet.GetCustomers()
m_CustomersGrid.DataSource = nwData
m_CustomersGrid.DataMember = "Customers"

Dim table as DataTable = nwData.Customers
m_CustomerTextBox.DataBindings.Add("Text", table, "CustomerID", True)

Robin S.
--------------------------------------------------------------

"Arne Beruldsen" <ArneBeruldsen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:8271EF84-0CFB-462A-9B42-2650C216F393@xxxxxxxxxxxxxxxx
in vbnet2005 I have a datagridview. When the user clicks on a row...I
would
like the contents of certain cells to populate a textbox. To do
this...i
need to be able to refer to the row and colums...something like
textbox = contents (rx, cx)

How can I refer to the cell contents?

Thanks....





.



Relevant Pages

  • RE: Updating the forms fields
    ... in the grid, the combobox and textbox will clear as well. ... ComboBox and TextBox on your Form ... the DataError event of the BindingSource. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Updating the forms fields
    ... in the grid, the combobox and textbox will clear as well. ... ComboBox and TextBox on your Form ... the DataError event of the BindingSource. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Updating the forms fields
    ... Are you databinding a ComboBox to one BindingSource and a DataGrid ... Bind the TextBox to the same BindingSource as the ... The problem is when I apply a filter in the grid, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Datagridview...cell contents
    ... Robin S. ... you can bind your datagrid to a BindingSource, ... BindingSource to the DataSet. ... Then you can bind the textbox to the same BindingSource. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Newbie Missing Something with Access DB Update Using VB .NET
    ... I use the BindingSource in VB2005, ... Robin S. ... Access counterparts was to within the textbox properties, ... I have a slew of textbox controls bound to a dataset ...
    (microsoft.public.dotnet.framework.adonet)