Re: Vb.net 2008 Datagridview bound/unbound columns update datasour

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Rob,

If you do not need to store the column information - no need to:
Consider the following code:
Dim source As DataTable = getDataFromSqlServer()
source.Columns.Add("Selected", GetType(Boolean))
myDataGridView.DataSource = source

This way you only use the column where you need it.
Also there is no need to use FormattedValue, you can use Value instead:
Bookings.Cells("selectColumn").Value = True

Hope this helps

"Rob W" wrote:

Thanks for the suggestion I had thought of this but was interested in
alternatives, with nothing forth coming I decided to store the column
though not really data
as is used to select rows for the purpose of deletion.

Ensuring I check the formatted value in a loop to remove the data e.g.
Bookings.Cells("selectColumn").FormattedValue = "True"


I created a new field as a bit to store the value of the
datagridviewcheckboxcell in SQLServer e.g.
Select CAST( 0 as bit) AS selectColumn

All works as intended now :-)

Thanks
Rob

"Sergey Poberezovskiy" <SergeyPoberezovskiy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:797E0D52-CFA4-4175-9ED3-830063ABDFCA@xxxxxxxxxxxxxxxx
Rob,

I might be wrong, but I suspect that because the grid checkbox column is
not
bound, then during DataSource change (when you remove the row) it resets
unbound columns to the default values - unchecked.

Is there any reason why you need the checkboxes unbound - you may add a
(boolean) column to the table and then bound the checkboxcolumn to that.
This
way grid should know where to get the values for individual rows from.

Hope this helps

"Rob W" wrote:

Greetings,

Well this is really a continuation from a previous thread and I've
exhausted
all my resources in finding an answer so posting in it's own thread.

A datagridview is created programmatically and then the datasource is set
to
a dataset with all but the datagridviewcheckboxcells bound using the
dataproperty option.

If I change the underlying datasoure I.e. the datatable (e.g. removing a
datarow) then the unbound columns if checkbox values are selected i.e.
true
are ALL set to false.

Is this usual behaviour? Can I prevent this?

I couldn't find a single item on the Internet to reference anyone else
experiencing the same, apologies if being really stupid but need some
guidance here, can anyone please offer some advice and guidance?

Thanks
Rob


.



.

.



Relevant Pages

  • Re: Vb.net 2008 Datagridview bound/unbound columns update datasource e
    ... I created a new field as a bit to store the value of the ... but I suspect that because the grid checkbox column is ... A datagridview is created programmatically and then the datasource is set ... datarow) then the unbound columns if checkbox values are selected i.e. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: building dynamic list of web from controls
    ... I think I did misunderstand your ... Then, when we retrieve the CheckBox later in postback event, we can check ... adding an additional HIDDEN control into the template to store the identity ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Temporary tables in A2K/ADO
    ... Dim strOut As String ... Dim strForm As String ... Next to each record would be a checkbox. ... >table should store a field from table1 and the yes/no value from the ...
    (comp.databases.ms-access)
  • Re: checkbox code to autofill date and once date hit unchecks itse
    ... means it would be a violation of normalization principles to store it. ... Doug Steele, Microsoft Access MVP ... why would making the checkbox bound to the table be a mistake? ... Private Sub MyCheckBox_AfterUpdate ...
    (microsoft.public.access.formscoding)
  • Sql2000 storing and retrieve checkbox value..
    ... I am able to store the value of the checkbox and retrieve when i want to ... Now sql 2000 store value as True and False for checked and notchecked... ...
    (microsoft.public.dotnet.languages.csharp)