This command gives you a total count of all the files or subdirectories in a certain directory. This command is for unix-type operating systems.
find . -type f | wc -l
Sometimes we need a little more knowledge if we want to be successful in the field of affiliate marketing.
Clickbooth has already established itself as one of the best in the area of internet marketing. And they want you to be even more successful with where you are now or if you are just starting out. Clickbooth Webinars provides you videos of top internet marketers discussing everything related to affiliated marketing that made them successful in this field. If you have no idea what a webinar is, it is short for online seminar.
Whether it is a positive or a negative thing, you will be given insights and ideas with their experiences and the challenges they faced to get to where they are now. What is good with the webinars is that there are no hitches. You can sign up for free to gain access with existing webinars and more upcoming ones. Each webinar last mostly an hour, more or less and you can just get back to one or skip it anytime giving you flexibility when you want to watch and hear them anytime. These webinars can definitely aid and help you in your goal to become successful in this area.
Share the post "C#: Add Select All, Deselect All Checkbox In Column Header In DataGridView Control"
Adding controls to your DataGridView like a checkbox as a column is possible with the use of the 
DataGridViewCheckboxColumn class. This post assumes that you are using the DataGridView control in a Windows.Form application and that your gridview object can already populate data into it. The purpose of this post is to add a column containing checkboxes including a header checkbox, used to select and deselect all in one click.
![]()
The name of our DataGridView control is list. To add a checkbox column into the gridview control, use the following code below inside your className_Load() method.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// customize dataviewgrid, add checkbox column DataGridViewCheckBoxColumn checkboxColumn = new DataGridViewCheckBoxColumn(); checkboxColumn.Width = 30; checkboxColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; list.Columns.Insert(0, checkboxColumn); // add checkbox header Rectangle rect = list.GetCellDisplayRectangle(0, -1, true); // set checkbox header to center of header cell. +1 pixel to position correctly. rect.X = rect.Location.X + (rect.Width / 4); CheckBox checkboxHeader = new CheckBox(); checkboxHeader.Name = "checkboxHeader"; checkboxHeader.Size = new Size(18, 18); checkboxHeader.Location = rect.Location; checkboxHeader.CheckedChanged += new EventHandler(checkboxHeader_CheckedChanged); list.Controls.Add(checkboxHeader); |
The method that does the selecting and deselecting of all checkboxes within the checkbox column is made possible with the CheckedChanged event. We add an event handler for this to make it work.
|
1 2 3 4 5 6 |
private void checkboxHeader_CheckedChanged(object sender, EventArgs e) { for (int i = 0; i < list.RowCount; i++) { list[0, i].Value = ((CheckBox) list.Controls.Find("checkboxHeader", true)[0]).Checked; } list.EndEdit(); } |
That’s all there is to it. If you may wonder how to make the checkbox header align to the center, the code that makes that happen is the part where there is a Rectangle object used.
|
1 2 3 4 |
// add checkbox header Rectangle rect = list.GetCellDisplayRectangle(0, -1, true); // set checkbox header to center of header cell. +1 pixel to position correctly. rect.X = rect.Location.X + (rect.Width4); |
I divided the cell area’s width by 4 instead of 2 because I had to take into account the checkbox header’s width value. By the way, you also need to set the DataGridView control’s AutoSizeColumnsMode property to Fill so that all any empty spaces within the DataGridView control will be occupied