473,729 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid Checkbox Column

im trying (unsucessfully) to add a checkbox column to my datagrid

i basically have a datagrid that im populating from a dataset

Me.DataGrid1.Da taSource = ds.Tables(0)

the datagrid then has 5 columns in it but i need to add a sixth column
which will be my checkbox column - any help or pointers with this
would be great

Thanks

Mike
Nov 20 '05 #1
17 7433
You need to add a TableStyle to the Grid, including the Columns you want.
Make the last Column you add to the style a DataGridCheckBo xColumn

/Lars
"Mike Fellows" <mi************ ***@equityhouse .co.uk> skrev i meddelandet
news:Qp******** ****@newsfe1-gui.server.ntli .net...
im trying (unsucessfully) to add a checkbox column to my datagrid

i basically have a datagrid that im populating from a dataset

Me.DataGrid1.Da taSource = ds.Tables(0)

the datagrid then has 5 columns in it but i need to add a sixth column
which will be my checkbox column - any help or pointers with this
would be great

Thanks

Mike

Nov 20 '05 #2
http://www.knowdotnet.com/articles/kdngrid.html

try this
"Mike Fellows" <mi************ ***@equityhouse .co.uk> wrote in message
news:Qp******** ****@newsfe1-gui.server.ntli .net...
im trying (unsucessfully) to add a checkbox column to my datagrid

i basically have a datagrid that im populating from a dataset

Me.DataGrid1.Da taSource = ds.Tables(0)

the datagrid then has 5 columns in it but i need to add a sixth column
which will be my checkbox column - any help or pointers with this
would be great

Thanks

Mike

Nov 20 '05 #3
Sadly that made no sense to me at all

Thanks anyway

Mike
"Ali BAKDUR" <al*******@hotm ail.com> wrote in message
news:OD******** ******@TK2MSFTN GP12.phx.gbl...
http://www.knowdotnet.com/articles/kdngrid.html

try this
"Mike Fellows" <mi************ ***@equityhouse .co.uk> wrote in message
news:Qp******** ****@newsfe1-gui.server.ntli .net...
im trying (unsucessfully) to add a checkbox column to my datagrid

i basically have a datagrid that im populating from a dataset

Me.DataGrid1.Da taSource = ds.Tables(0)

the datagrid then has 5 columns in it but i need to add a sixth column
which will be my checkbox column - any help or pointers with this
would be great

Thanks

Mike


Nov 20 '05 #4
Ok,

ive added my TableStyle (i think)

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"
DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)

but now i still have no idea how to add the extra column

Thanks

Mike
"Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
You need to add a TableStyle to the Grid, including the Columns you want.
Make the last Column you add to the style a DataGridCheckBo xColumn

/Lars
"Mike Fellows" <mi************ ***@equityhouse .co.uk> skrev i meddelandet
news:Qp******** ****@newsfe1-gui.server.ntli .net...
im trying (unsucessfully) to add a checkbox column to my datagrid

i basically have a datagrid that im populating from a dataset

Me.DataGrid1.Da taSource = ds.Tables(0)

the datagrid then has 5 columns in it but i need to add a sixth column
which will be my checkbox column - any help or pointers with this
would be great

Thanks

Mike


Nov 20 '05 #5
thanks, well that sort of helped as i can now manuipulate my other columns
easier but im still no closer to adding a
check box

heres my current code:

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column
txtID.MappingNa me = "ID"
txtID.HeaderTex t = "ID"
txtID.Width = 50
ts.GridColumnSt yles.Add(txtID)

Dim txtID1 As New DataGridTextBox Column
txtID1.MappingN ame = "Postcode"
txtID1.HeaderTe xt = "Postcode"
txtID1.Width = 80
ts.GridColumnSt yles.Add(txtID1 )

Dim txtID2 As New DataGridTextBox Column
txtID2.MappingN ame = "DistributionVo lume"
txtID2.HeaderTe xt = "Distributi on Volume"
txtID2.Width = 80
ts.GridColumnSt yles.Add(txtID2 )

Dim txtID3 As New DataGridTextBox Column
txtID3.MappingN ame = "Distributo r"
txtID3.HeaderTe xt = "Distributo r"
txtID3.Width = 80
ts.GridColumnSt yles.Add(txtID3 )

Dim txtID4 As New DataGridTextBox Column
txtID4.MappingN ame = "Frequency"
txtID4.HeaderTe xt = "Frequency"
txtID4.Width = 80
ts.GridColumnSt yles.Add(txtID4 )

Dim txtID5 As New DataGridTextBox Column
txtID5.MappingN ame = "WeekCommencing "
txtID5.HeaderTe xt = "Week Commencing"
txtID5.Width = 80
ts.GridColumnSt yles.Add(txtID5 )

Dim txtID6 As New DataGridTextBox Column
txtID6.MappingN ame = "Active"
txtID6.HeaderTe xt = "Active"
txtID6.Width = 80
ts.GridColumnSt yles.Add(txtID6 )

Dim txtID7 As New DataGridTextBox Column
txtID7.MappingN ame = ""
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
i dont seem to be able to add the DataGridCheckBo xColumn you originally
mentioned
and also this column should not be mapped to anything

Thanks

Mike

"Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
news:OF******** *****@TK2MSFTNG P11.phx.gbl...
Here: You create a Column and add to the style that you then add to the Grid (like you did)

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column

txtID.MappingNa me = "ID column name from database"

txtID.HeaderTex t = "ID"

txtID.Width = 50

ts.GridColumnSt yles.Add(txtID)

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
/Lars

"Mike Fellows" <mi************ ***@equityhouse .co.uk> skrev i meddelandet
news:rf******** *****@newsfe1-gui.server.ntli .net...
Ok,

ive added my TableStyle (i think)

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"
DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)

but now i still have no idea how to add the extra column

Thanks

Mike
"Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
You need to add a TableStyle to the Grid, including the Columns you want. Make the last Column you add to the style a DataGridCheckBo xColumn

/Lars
"Mike Fellows" <mi************ ***@equityhouse .co.uk> skrev i meddelandet news:Qp******** ****@newsfe1-gui.server.ntli .net...
> im trying (unsucessfully) to add a checkbox column to my datagrid
>
> i basically have a datagrid that im populating from a dataset
>
> Me.DataGrid1.Da taSource = ds.Tables(0)
>
> the datagrid then has 5 columns in it but i need to add a sixth column > which will be my checkbox column - any help or pointers with this
> would be great
>
> Thanks
>
> Mike
>
>



Nov 20 '05 #6
Hi,

Add a new column to your dataset. Add a datagridboolcol umn to your
tablestyle.

Dim dc As New DataColumn("MyB oolColumn", GetType(Boolean ))
dc.DefaultValue = False
ds.Tables("Tabl e").Columns.Add (dc)

Dim txtID7 As New DataGridBoolCol umn
txtID7.MappingN ame = "MyBoolColu mn"
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

Ken
------------------

"Mike Fellows" <mi************ ***@equityhouse .co.uk> wrote in message
news:DM******** ****@newsfe1-gui.server.ntli .net:
thanks, well that sort of helped as i can now manuipulate my other columns

easier but im still no closer to adding a
check box

heres my current code:

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column
txtID.MappingNa me = "ID"
txtID.HeaderTex t = "ID"
txtID.Width = 50
ts.GridColumnSt yles.Add(txtID)

Dim txtID1 As New DataGridTextBox Column
txtID1.MappingN ame = "Postcode"
txtID1.HeaderTe xt = "Postcode"
txtID1.Width = 80
ts.GridColumnSt yles.Add(txtID1 )

Dim txtID2 As New DataGridTextBox Column
txtID2.MappingN ame = "DistributionVo lume"
txtID2.HeaderTe xt = "Distributi on Volume"
txtID2.Width = 80
ts.GridColumnSt yles.Add(txtID2 )

Dim txtID3 As New DataGridTextBox Column
txtID3.MappingN ame = "Distributo r"
txtID3.HeaderTe xt = "Distributo r"
txtID3.Width = 80
ts.GridColumnSt yles.Add(txtID3 )

Dim txtID4 As New DataGridTextBox Column
txtID4.MappingN ame = "Frequency"
txtID4.HeaderTe xt = "Frequency"
txtID4.Width = 80
ts.GridColumnSt yles.Add(txtID4 )

Dim txtID5 As New DataGridTextBox Column
txtID5.MappingN ame = "WeekCommencing "
txtID5.HeaderTe xt = "Week Commencing"
txtID5.Width = 80
ts.GridColumnSt yles.Add(txtID5 )

Dim txtID6 As New DataGridTextBox Column
txtID6.MappingN ame = "Active"
txtID6.HeaderTe xt = "Active"
txtID6.Width = 80
ts.GridColumnSt yles.Add(txtID6 )

Dim txtID7 As New DataGridTextBox Column
txtID7.MappingN ame = ""
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
i dont seem to be able to add the DataGridCheckBo xColumn you originally
mentioned
and also this column should not be mapped to anything

Thanks

Mike

"Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
news:OF******** *****@TK2MSFTNG P11.phx.gbl...
Here: You create a Column and add to the style that you then add to
the


Grid
(like you did)

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column

txtID.MappingNa me = "ID column name from database"

txtID.HeaderTex t = "ID"

txtID.Width = 50

ts.GridColumnSt yles.Add(txtID)

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
/Lars

"Mike Fellows" <HYPERLINK
"mailto:mi***** **********@equi tyhouse.co.uk"m i************** *@equityhouse.c o
.uk> skrev i meddelandet
news:rf******** *****@newsfe1-gui.server.ntli .net...

Ok,

ive added my TableStyle (i think)

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"
DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)

but now i still have no idea how to add the extra column

Thanks

Mike
"Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l... You need to add a TableStyle to the Grid, including the Columns
> you
want.

Make the last Column you add to the style a DataGridCheckBo xColumn
>
> /Lars
>
>
> "Mike Fellows" <HYPERLINK
> "mailto:mi***** **********@equi tyhouse.co.uk"m i************** *@equityhouse.c o
> .uk> skrev i
meddelandet
news:Qp******** ****@newsfe1-gui.server.ntli .net... > im trying (unsucessfully) to add a checkbox column to my
> > datagrid
> >
> > i basically have a datagrid that im populating from a dataset
> >
> > Me.DataGrid1.Da taSource = ds.Tables(0)
> >
> > the datagrid then has 5 columns in it but i need to add a sixth
column
> which will be my checkbox column - any help or pointers with
> > this
> > would be great
> >
> > Thanks
> >
> > Mike
> >
> >
>
>



--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.0 - Release Date: 6/12/2004
Nov 20 '05 #7
Thanks Ken

works a treat

Mike

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:u7******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Add a new column to your dataset. Add a datagridboolcol umn to your
tablestyle.

Dim dc As New DataColumn("MyB oolColumn", GetType(Boolean ))
dc.DefaultValue = False
ds.Tables("Tabl e").Columns.Add (dc)

Dim txtID7 As New DataGridBoolCol umn
txtID7.MappingN ame = "MyBoolColu mn"
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

Ken
------------------

"Mike Fellows" <mi************ ***@equityhouse .co.uk> wrote in message
news:DM******** ****@newsfe1-gui.server.ntli .net:
thanks, well that sort of helped as i can now manuipulate my other columns
easier but im still no closer to adding a
check box

heres my current code:

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column
txtID.MappingNa me = "ID"
txtID.HeaderTex t = "ID"
txtID.Width = 50
ts.GridColumnSt yles.Add(txtID)

Dim txtID1 As New DataGridTextBox Column
txtID1.MappingN ame = "Postcode"
txtID1.HeaderTe xt = "Postcode"
txtID1.Width = 80
ts.GridColumnSt yles.Add(txtID1 )

Dim txtID2 As New DataGridTextBox Column
txtID2.MappingN ame = "DistributionVo lume"
txtID2.HeaderTe xt = "Distributi on Volume"
txtID2.Width = 80
ts.GridColumnSt yles.Add(txtID2 )

Dim txtID3 As New DataGridTextBox Column
txtID3.MappingN ame = "Distributo r"
txtID3.HeaderTe xt = "Distributo r"
txtID3.Width = 80
ts.GridColumnSt yles.Add(txtID3 )

Dim txtID4 As New DataGridTextBox Column
txtID4.MappingN ame = "Frequency"
txtID4.HeaderTe xt = "Frequency"
txtID4.Width = 80
ts.GridColumnSt yles.Add(txtID4 )

Dim txtID5 As New DataGridTextBox Column
txtID5.MappingN ame = "WeekCommencing "
txtID5.HeaderTe xt = "Week Commencing"
txtID5.Width = 80
ts.GridColumnSt yles.Add(txtID5 )

Dim txtID6 As New DataGridTextBox Column
txtID6.MappingN ame = "Active"
txtID6.HeaderTe xt = "Active"
txtID6.Width = 80
ts.GridColumnSt yles.Add(txtID6 )

Dim txtID7 As New DataGridTextBox Column
txtID7.MappingN ame = ""
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
i dont seem to be able to add the DataGridCheckBo xColumn you originally
mentioned
and also this column should not be mapped to anything

Thanks

Mike

"Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
news:OF******** *****@TK2MSFTNG P11.phx.gbl...
Here: You create a Column and add to the style that you then add to
the


Grid
(like you did)

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column

txtID.MappingNa me = "ID column name from database"

txtID.HeaderTex t = "ID"

txtID.Width = 50

ts.GridColumnSt yles.Add(txtID)

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
/Lars

"Mike Fellows" <HYPERLINK
"mailto:mi***** **********@equi tyhouse.co.uk"m i************** *@equityhouse.c o .uk> skrev i meddelandet
news:rf******** *****@newsfe1-gui.server.ntli .net...

> Ok,
>
> ive added my TableStyle (i think)
>
> Dim ts As New DataGridTableSt yle
> ts.MappingName = "Table"
> DataGrid1.Table Styles.Clear()
> DataGrid1.Table Styles.Add(ts)
> Me.DataGrid1.Da taSource = ds.Tables(0)
>
> but now i still have no idea how to add the extra column
>
> Thanks
>
> Mike
>
>
> "Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
> news:%2******** **********@TK2M SFTNGP11.phx.gb l...

> > You need to add a TableStyle to the Grid, including the Columns
> > you

want.

> > Make the last Column you add to the style a DataGridCheckBo xColumn
> >
> > /Lars
> >
> >
> > "Mike Fellows" <HYPERLINK
> > "mailto:mi***** **********@equi tyhouse.co.uk"m i************** *@equityhouse.c o > > .uk> skrev i


meddelandet
> > news:Qp******** ****@newsfe1-gui.server.ntli .net...

> > > im trying (unsucessfully) to add a checkbox column to my
> > > datagrid
> > >
> > > i basically have a datagrid that im populating from a dataset
> > >
> > > Me.DataGrid1.Da taSource = ds.Tables(0)
> > >
> > > the datagrid then has 5 columns in it but i need to add a sixth


column
> > > which will be my checkbox column - any help or pointers with
> > > this
> > > would be great
> > >
> > > Thanks
> > >
> > > Mike
> > >
> > >
> >
> >
>
>



--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.0 - Release Date: 6/12/2004

Nov 20 '05 #8
Ken,

any idea why my checkbox seems to have 3 states, True, false and DBNull

Mike

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:u7******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Add a new column to your dataset. Add a datagridboolcol umn to your
tablestyle.

Dim dc As New DataColumn("MyB oolColumn", GetType(Boolean ))
dc.DefaultValue = False
ds.Tables("Tabl e").Columns.Add (dc)

Dim txtID7 As New DataGridBoolCol umn
txtID7.MappingN ame = "MyBoolColu mn"
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

Ken
------------------

"Mike Fellows" <mi************ ***@equityhouse .co.uk> wrote in message
news:DM******** ****@newsfe1-gui.server.ntli .net:
thanks, well that sort of helped as i can now manuipulate my other columns
easier but im still no closer to adding a
check box

heres my current code:

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column
txtID.MappingNa me = "ID"
txtID.HeaderTex t = "ID"
txtID.Width = 50
ts.GridColumnSt yles.Add(txtID)

Dim txtID1 As New DataGridTextBox Column
txtID1.MappingN ame = "Postcode"
txtID1.HeaderTe xt = "Postcode"
txtID1.Width = 80
ts.GridColumnSt yles.Add(txtID1 )

Dim txtID2 As New DataGridTextBox Column
txtID2.MappingN ame = "DistributionVo lume"
txtID2.HeaderTe xt = "Distributi on Volume"
txtID2.Width = 80
ts.GridColumnSt yles.Add(txtID2 )

Dim txtID3 As New DataGridTextBox Column
txtID3.MappingN ame = "Distributo r"
txtID3.HeaderTe xt = "Distributo r"
txtID3.Width = 80
ts.GridColumnSt yles.Add(txtID3 )

Dim txtID4 As New DataGridTextBox Column
txtID4.MappingN ame = "Frequency"
txtID4.HeaderTe xt = "Frequency"
txtID4.Width = 80
ts.GridColumnSt yles.Add(txtID4 )

Dim txtID5 As New DataGridTextBox Column
txtID5.MappingN ame = "WeekCommencing "
txtID5.HeaderTe xt = "Week Commencing"
txtID5.Width = 80
ts.GridColumnSt yles.Add(txtID5 )

Dim txtID6 As New DataGridTextBox Column
txtID6.MappingN ame = "Active"
txtID6.HeaderTe xt = "Active"
txtID6.Width = 80
ts.GridColumnSt yles.Add(txtID6 )

Dim txtID7 As New DataGridTextBox Column
txtID7.MappingN ame = ""
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
i dont seem to be able to add the DataGridCheckBo xColumn you originally
mentioned
and also this column should not be mapped to anything

Thanks

Mike

"Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
news:OF******** *****@TK2MSFTNG P11.phx.gbl...
Here: You create a Column and add to the style that you then add to
the


Grid
(like you did)

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column

txtID.MappingNa me = "ID column name from database"

txtID.HeaderTex t = "ID"

txtID.Width = 50

ts.GridColumnSt yles.Add(txtID)

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
/Lars

"Mike Fellows" <HYPERLINK
"mailto:mi***** **********@equi tyhouse.co.uk"m i************** *@equityhouse.c o .uk> skrev i meddelandet
news:rf******** *****@newsfe1-gui.server.ntli .net...

> Ok,
>
> ive added my TableStyle (i think)
>
> Dim ts As New DataGridTableSt yle
> ts.MappingName = "Table"
> DataGrid1.Table Styles.Clear()
> DataGrid1.Table Styles.Add(ts)
> Me.DataGrid1.Da taSource = ds.Tables(0)
>
> but now i still have no idea how to add the extra column
>
> Thanks
>
> Mike
>
>
> "Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
> news:%2******** **********@TK2M SFTNGP11.phx.gb l...

> > You need to add a TableStyle to the Grid, including the Columns
> > you

want.

> > Make the last Column you add to the style a DataGridCheckBo xColumn
> >
> > /Lars
> >
> >
> > "Mike Fellows" <HYPERLINK
> > "mailto:mi***** **********@equi tyhouse.co.uk"m i************** *@equityhouse.c o > > .uk> skrev i


meddelandet
> > news:Qp******** ****@newsfe1-gui.server.ntli .net...

> > > im trying (unsucessfully) to add a checkbox column to my
> > > datagrid
> > >
> > > i basically have a datagrid that im populating from a dataset
> > >
> > > Me.DataGrid1.Da taSource = ds.Tables(0)
> > >
> > > the datagrid then has 5 columns in it but i need to add a sixth


column
> > > which will be my checkbox column - any help or pointers with
> > > this
> > > would be great
> > >
> > > Thanks
> > >
> > > Mike
> > >
> > >
> >
> >
>
>



--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.0 - Release Date: 6/12/2004

Nov 20 '05 #9
Hi,

That's it default behavior.
http://msdn.microsoft.com/library/de...ClassTopic.asp

Ken
---------------

"Mike Fellows" <mi************ ***@equityhouse .co.uk> wrote in message
news:UJ******** *****@newsfe1-gui.server.ntli .net:
Ken,

any idea why my checkbox seems to have 3 states, True, false and DBNull

Mike

"Ken Tucker [MVP]" <HYPERLINK
"mailto:vb***@b ellsouth.net"vb ***@bellsouth.n et> wrote in message
news:u7******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Add a new column to your dataset. Add a datagridboolcol umn to your
tablestyle.

Dim dc As New DataColumn("MyB oolColumn", GetType(Boolean ))
dc.DefaultValue = False
ds.Tables("Tabl e").Columns.Add (dc)

Dim txtID7 As New DataGridBoolCol umn
txtID7.MappingN ame = "MyBoolColu mn"
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

Ken
------------------

"Mike Fellows" <HYPERLINK
"mailto:mi***** **********@equi tyhouse.co.uk"m i************** *@equityhouse.c o
.uk> wrote in message
news:DM******** ****@newsfe1-gui.server.ntli .net:

thanks, well that sort of helped as i can now manuipulate my other
columns

easier but im still no closer to adding a
check box

heres my current code:

Dim ts As New DataGridTableSt yle
ts.MappingName = "Table"

Dim txtID As New DataGridTextBox Column
txtID.MappingNa me = "ID"
txtID.HeaderTex t = "ID"
txtID.Width = 50
ts.GridColumnSt yles.Add(txtID)

Dim txtID1 As New DataGridTextBox Column
txtID1.MappingN ame = "Postcode"
txtID1.HeaderTe xt = "Postcode"
txtID1.Width = 80
ts.GridColumnSt yles.Add(txtID1 )

Dim txtID2 As New DataGridTextBox Column
txtID2.MappingN ame = "DistributionVo lume"
txtID2.HeaderTe xt = "Distributi on Volume"
txtID2.Width = 80
ts.GridColumnSt yles.Add(txtID2 )

Dim txtID3 As New DataGridTextBox Column
txtID3.MappingN ame = "Distributo r"
txtID3.HeaderTe xt = "Distributo r"
txtID3.Width = 80
ts.GridColumnSt yles.Add(txtID3 )

Dim txtID4 As New DataGridTextBox Column
txtID4.MappingN ame = "Frequency"
txtID4.HeaderTe xt = "Frequency"
txtID4.Width = 80
ts.GridColumnSt yles.Add(txtID4 )

Dim txtID5 As New DataGridTextBox Column
txtID5.MappingN ame = "WeekCommencing "
txtID5.HeaderTe xt = "Week Commencing"
txtID5.Width = 80
ts.GridColumnSt yles.Add(txtID5 )

Dim txtID6 As New DataGridTextBox Column
txtID6.MappingN ame = "Active"
txtID6.HeaderTe xt = "Active"
txtID6.Width = 80
ts.GridColumnSt yles.Add(txtID6 )

Dim txtID7 As New DataGridTextBox Column
txtID7.MappingN ame = ""
txtID7.HeaderTe xt = "CHECKBOX HERE PLEASE"
txtID7.Width = 120
ts.GridColumnSt yles.Add(txtID7 )

DataGrid1.Table Styles.Clear()
DataGrid1.Table Styles.Add(ts)
Me.DataGrid1.Da taSource = ds.Tables(0)
i dont seem to be able to add the DataGridCheckBo xColumn you
originally
mentioned
and also this column should not be mapped to anything

Thanks

Mike

"Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
news:OF******** *****@TK2MSFTNG P11.phx.gbl...
Here: You create a Column and add to the style that you then add
> to
> the
Grid
(like you did)
>
> Dim ts As New DataGridTableSt yle
> ts.MappingName = "Table"
>
> Dim txtID As New DataGridTextBox Column
>
> txtID.MappingNa me = "ID column name from database"
>
> txtID.HeaderTex t = "ID"
>
> txtID.Width = 50
>
> ts.GridColumnSt yles.Add(txtID)
>
> DataGrid1.Table Styles.Clear()
> DataGrid1.Table Styles.Add(ts)
> Me.DataGrid1.Da taSource = ds.Tables(0)
>
>
> /Lars
>
> "Mike Fellows" <HYPERLINK
>
"mailto:mi***** **********@equi tyhouse.co.uk"H YPERLINK
"mailto:mi***** **********@equi tyhouse.co"mi** *************@e quityhouse.co
.uk> skrev i meddelandet
> news:rf******** *****@newsfe1-gui.server.ntli .net...
> Ok,
> >
> > ive added my TableStyle (i think)
> >
> > Dim ts As New DataGridTableSt yle
> > ts.MappingName = "Table"
> > DataGrid1.Table Styles.Clear()
> > DataGrid1.Table Styles.Add(ts)
> > Me.DataGrid1.Da taSource = ds.Tables(0)
> >
> > but now i still have no idea how to add the extra column
> >
> > Thanks
> >
> > Mike
> >
> >
> > "Lars Netzel" <[stop_spam]@host.topdomain > wrote in message
> > news:%2******** **********@TK2M SFTNGP11.phx.gb l...
> > You need to add a TableStyle to the Grid, including the
> > > Columns
> > > you
want.
> > Make the last Column you add to the style a
> > > DataGridCheckBo xColumn
> > >
> > > /Lars
> > >
> > >
> > > "Mike Fellows" <HYPERLINK
> > >
"mailto:mi***** **********@equi tyhouse.co.uk"H YPERLINK
"mailto:mi***** **********@equi tyhouse.co"mi** *************@e quityhouse.co
> > .uk> skrev i
meddelandet
> > news:Qp******** ****@newsfe1-gui.server.ntli .net...
> > > im trying (unsucessfully) to add a checkbox column to my
> > > > datagrid
> > > >
> > > > i basically have a datagrid that im populating from a
> > > > dataset
> > > >
> > > > Me.DataGrid1.Da taSource = ds.Tables(0)
> > > >
> > > > the datagrid then has 5 columns in it but i need to add a
> > > > sixth
column
> > > which will be my checkbox column - any help or pointers with
> > > > this
> > > > would be great
> > > >
> > > > Thanks
> > > >
> > > > Mike
> > > >
> > > >
> > >
> > >
> >
> >
>

>

--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.0 - Release Date: 6/12/2004


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.0 - Release Date: 6/12/2004
Nov 20 '05 #10

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

Similar topics

5
2639
by: Jean Carlo | last post by:
Hello guys I`m developing a windows form that contain one Datagrid. In this datagrid I insert a checkBox Column. I need to get all rows where checkbox is checked by user. How do I get this rows ? I can´t use the DataSource of Datagrid because I don´t have a Column source for checkBox in my DataSource. Is there any method in datagrid to loop in datagrid rows ?
2
3148
by: Sebi | last post by:
Hello all is it possible to add a checkbox in a DataGrid for Boolean Data? Thanks in advance
0
2403
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a CheckBox Programmatically" in my code. I have changed it to use a OLDDB.DBReader to populate the datagrid and for the databinding. It works perfectly - also when using the edit-mode in the datagrid.
4
1850
by: Mike | last post by:
Hi, Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject? Thanks Mike
2
2463
by: Mortar | last post by:
i have a datagrid with 2 columns. the 1st column contains an id which will be used by the database for the selected checkbox records. the 2nd column is a template column containing a server checkbox control. where i'm at: i can retrieve a count of the selected checkboxes, but don't know how to get the related id's (in the 1st column).
10
2442
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox control in a datagrid? Now I have a Select column but the problem is that the user needs to select more than one record and send them all to print, instead of being one by one like is now with the Select column. Another question, is it possible to...
9
3189
by: tshad | last post by:
I have a datagrid that I want to add a new column to. This column will only be visible under certain conditions. So I want to set the column visible=false. Then when the right condition happens to change it to visible=true. You can't do that with a bound column (no ID), but you can create a templatecolumn with a label. To make these visible, I am going through each datagriditem and making them visible after I have bound the data to...
1
4234
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get the example to work. I created the following two classes, provided with the example: *-*-**-*-*-*-*-*-*-*-*-*-**-*-*-*-*-CheckBoxColumn Class:-*-*-*-*-*-*-*-*-*-*-**-*-*-*-*-**-*-*-*
9
1593
by: Rekha | last post by:
The data is filled in datagrid. I want to know how to add a checkbox column in datagrid? In the runtime, checkbox is checked then instead of checkbox value the (caseID )column value is retained. I know there is a lot of article on datagrid with checkbox but nothing helped me . Can anyone help me how to proceed ? Thanks
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6016
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.