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

datagrid add checkboxes

i have the folowing code to setup my datagrid collumns

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

gridsetup()

end sub

Private Sub gridsetup()

O.Columns.Add("Channel")

O.Columns.Add("Name")

O.Columns.Add("Status")

O.Columns.Add("On")

O.Columns.Add("Time Modified")

DataGrid1.DataSource = O

End Sub

then i can add rows with some more code

but now my question is, how can y simply add a collumn with checkboxes

thanks Maarten
Nov 21 '05 #1
4 1366
Maarten,

This link about this question I sent yesterday to the message where you were
asking almost the same question.

http://msdn.microsoft.com/library/de...classtopic.asp

Did you not see it?

Cor

"Maarten" <gu******@hotmail.com>
i have the folowing code to setup my datagrid collumns

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

gridsetup()

end sub

Private Sub gridsetup()

O.Columns.Add("Channel")

O.Columns.Add("Name")

O.Columns.Add("Status")

O.Columns.Add("On")

O.Columns.Add("Time Modified")

DataGrid1.DataSource = O

End Sub

then i can add rows with some more code

but now my question is, how can y simply add a collumn with checkboxes

thanks Maarten

Nov 21 '05 #2
indeed i went to the link yesterday, but the code ther looks all so complex
they generate the controls at runtime, and i can't figure out how to make a
collumstyle.

i added tried to shange some code to let the grid display a column with
checkboxes with my databinding, but it won't work.

i hope someone can help me

kind regards Maarten
"Maarten" <gu******@hotmail.com> wrote in message
news:41***********************@news.skynet.be...
i have the folowing code to setup my datagrid collumns

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

gridsetup()

end sub

Private Sub gridsetup()

O.Columns.Add("Channel")

O.Columns.Add("Name")

O.Columns.Add("Status")

O.Columns.Add("On")

O.Columns.Add("Time Modified")

DataGrid1.DataSource = O

End Sub

then i can add rows with some more code

but now my question is, how can y simply add a collumn with checkboxes

thanks Maarten

Nov 21 '05 #3
Maarten,

You cannot make a datagrid with checkboxes without the columnstyles, you are
even lucky that there is a standard boolcolumnstyle

On this page is as well a sample
http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps?

Cor
"Maarten" <gu******@hotmail.com>
indeed i went to the link yesterday, but the code ther looks all so
complex
they generate the controls at runtime, and i can't figure out how to make
a collumstyle.

i added tried to shange some code to let the grid display a column with
checkboxes with my databinding, but it won't work.

i hope someone can help me

kind regards Maarten
"Maarten" <gu******@hotmail.com> wrote in message
news:41***********************@news.skynet.be...
i have the folowing code to setup my datagrid collumns

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

gridsetup()

end sub

Private Sub gridsetup()

O.Columns.Add("Channel")

O.Columns.Add("Name")

O.Columns.Add("Status")

O.Columns.Add("On")

O.Columns.Add("Time Modified")

DataGrid1.DataSource = O

End Sub

then i can add rows with some more code

but now my question is, how can y simply add a collumn with checkboxes

thanks Maarten


Nov 21 '05 #4
ok i found some code to setup the table, and se collums.

but how can add some cource.

i tried to do so, but the styles do not effect the grid.

this is what i did.

Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

FormatGridWithBothTableAndColumnStyles()

addata()

End Sub

Private Sub FormatGridWithBothTableAndColumnStyles()

With DataGrid1

..BackColor = Color.GhostWhite

..BackgroundColor = Color.Lavender

..BorderStyle = BorderStyle.None

..CaptionBackColor = Color.RoyalBlue

..CaptionFont = New Font("Tahoma", 10.0!, FontStyle.Bold)

..CaptionForeColor = Color.Bisque

..CaptionText = "Northwind Products"

..Font = New Font("Tahoma", 8.0!)

..ParentRowsBackColor = Color.Lavender

..ParentRowsForeColor = Color.MidnightBlue

..DataSource() = D

End With

Dim grdTableStyle1 As New DataGridTableStyle()

With grdTableStyle1

..AlternatingBackColor = Color.GhostWhite

..BackColor = Color.GhostWhite

..ForeColor = Color.MidnightBlue

..GridLineColor = Color.RoyalBlue

..HeaderBackColor = Color.MidnightBlue

..HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)

..HeaderForeColor = Color.Lavender

..SelectionBackColor = Color.Teal

..SelectionForeColor = Color.PaleGreen

..MappingName = "Controler"

..PreferredColumnWidth = 125

..PreferredRowHeight = 15

End With

Dim grdColStyle1 As New DataGridBoolColumn()

With grdColStyle1

..HeaderText = "On/Off"

..MappingName = "ID"

..Width = 50

End With

Dim grdColStyle2 As New DataGridTextBoxColumn()

With grdColStyle2

..HeaderText = "Name"

..MappingName = "ChannelName"

End With

Dim grdColStyle3 As New DataGridTextBoxColumn()

With grdColStyle3

..HeaderText = "Value"

..MappingName = "Value"

..Width = 75

..ReadOnly = True

End With

grdTableStyle1.GridColumnStyles.AddRange(New DataGridColumnStyle()
{grdColStyle1, grdColStyle2, grdColStyle3, grdColStyle4})

DataGrid1.TableStyles.Add(grdTableStyle1)

End Sub

Private Sub addata()

Public D As New DataTable()

D.Columns.Add("Channel")

D.Columns.Add("Name")

D.Columns.Add("Value")

R = D.NewRow

R.Item(0) = true

R.Item(1) = dchanName(e.Index + 1)

R.Item(2) = dchanState(e.Index + 1)

R.Item(3) = dchanPos(e.Index + 1)

D.Rows.Add(R)
End Sub

i know this can't work, becouse when i add the code, i generate a datatable
independent from the table i created.

but how can i add the last items, so the get places in the formated
collumns

kind regard, and sorry i keep on troubeling you with probably stupid
questions.

Maarten
Nov 21 '05 #5

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

Similar topics

3
by: john | last post by:
I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the user clicks on a certain button on the page, which is not in the grid, I want to be able to...
2
by: Mortar | last post by:
i have a datagrid with a column of html checkboxes which are created dynamically. The id/name of the checkboxes comes from a value in the database. on a postback, i would like to get all the...
1
by: kannadasan | last post by:
Hi all I am using Datagrid where i place checkboxes in one column with some other columns.The purpose is, if i select the checkboxes and clicks the submit buton Email has to go to the selected...
7
by: DJ Dev | last post by:
Hi All, I have a complex problem. I have dropdownlists (usually 3-5) and the user selects some value from these and for each value selected, datagrids are shown to the user. I am creating the...
2
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the...
2
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...
7
by: Jaime Stuardo | last post by:
Hi all.. I have a DataGrid with checkboxes. In the header I have a "check all" checkbox. I'm wondering if there is an easy way to check all checkboxes using that checkbox. I could do it using...
3
by: GatorBait | last post by:
Hi all, I'm using a datagrid for the first time and I am running into some problems that I hope someone can help me with. I have a datagrid with 18 rows and 5 columns....column 1 is just text...
7
by: rn5a | last post by:
The first column of a DataGrid has a CheckBox for all the rows. I want that when users check a CheckBox, the BackColor of that entire row in the DataGrid should change to a different color. To...
5
by: rn5a | last post by:
In my application, I want to populate all the directories & files existing in a directory on the server in a DataGrid. To ensure that all the directories get listed first followed by all the files,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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,...

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.