Home All Groups Group Topic Archive Search About

Change state of detached column of dataGridView.

Author
10 Apr 2010 1:00 PM
Mr. X.
In VB.NET 2008 (VS 2008) I see I can change the state of an unChanged
column,
but for detached column - I cannot change the state.

        Dim objRowV As DataRowView
        Dim objRow As DataRow

        objRowV = myBindSource.Current
        objRow = objRowV.Row
        objRow("my_column") = 123

        objRow.SetAdded() ' **** this line troughs an exception. ****

.... How can I handle this case ?

Thanks :)

Author
10 Apr 2010 1:20 PM
Armin Zingler
Am 10.04.2010 15:00, schrieb Mr. X.:
Show quoteHide quote
> In VB.NET 2008 (VS 2008) I see I can change the state of an unChanged
> column,
> but for detached column - I cannot change the state.
>
>         Dim objRowV As DataRowView
>         Dim objRow As DataRow
>
>         objRowV = myBindSource.Current
>         objRow = objRowV.Row
>         objRow("my_column") = 123
>
>         objRow.SetAdded() ' **** this line troughs an exception. ****
>
> .... How can I handle this case ?
>
> Thanks :)

The state "Added" means it has been added to the datatable.
Add it to a datatable and it's state will be "Added".

Otherwise it's just an existing datarow.

--
Armin
Author
10 Apr 2010 1:39 PM
Mr. X.
Well, thanks. It works.

Thanks :)

Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:e#2hDDL2KHA.1392@TK2MSFTNGP04.phx.gbl...
> Am 10.04.2010 15:00, schrieb Mr. X.:
>> In VB.NET 2008 (VS 2008) I see I can change the state of an unChanged
>> column,
>> but for detached column - I cannot change the state.
>>
>>         Dim objRowV As DataRowView
>>         Dim objRow As DataRow
>>
>>         objRowV = myBindSource.Current
>>         objRow = objRowV.Row
>>         objRow("my_column") = 123
>>
>>         objRow.SetAdded() ' **** this line troughs an exception. ****
>>
>> .... How can I handle this case ?
>>
>> Thanks :)
>
> The state "Added" means it has been added to the datatable.
> Add it to a datatable and it's state will be "Added".
>
> Otherwise it's just an existing datarow.
>
> --
> Armin