Clickbooth Webinars

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.

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...

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.

// 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.

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.

// 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

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(2 votes, average: 5.00 out of 5)
 Loading ...

.NET: Forms And Panels

I was fooling around with Panels and Forms yesterday because I was checking out GUIs with .NET. Being one used to Java, I was glad that .NET came along with some good GUI frameworks since, even until now, Java, for me still could not conquer client side GUIs. Creating a stand alone application in .NET using C# and using Visual Studio 2005 as its editor is fairly easy. Just drag and drop controls from the toolkit to the form’s design area.

The problem came when I wanted to use Panels because I wanted to have sub containers within the Form so I could switch between Panels. I kept surfing for more than 3 hours but I still could not find out why when I drag controls to the design area of a Panel, instead of, say a button, a button’s icon will be displayed instead together with the word button instead of a button that looks like in HTML forms.

Turns out, a UserControl control is what you need. Totally wasted quite some valuable time looking for that and it was in a certain forum that mentioned UserControl that I thought I could check it out. To create a UserControl class, right click on the project name in Visual Studio 2005 in the solutions explorer (right side). Choose Add Item > UserControl. Then in the design area mode, you can drag and drop controls from the toolkit to there. I hope this can help newbies who are baffled why Panels do not work as containers like Forms do. In a way, they can be considered containers but for me, they really are just for grouping sets of controls. Kind of like the group boxes.

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...

Javascript: Close Popup Window In X Seconds

There comes a time when we need a visual display of how many seconds are left till the popup window closes. This short code does just that. It displays how many seconds are left and closes the popup window when the number of seconds is zero.

<script type="text/javascript"><!--mce:0--></script>

The HTML code would look like this

 
Window will close in <span id="time">5</span> second(s)

The Javascript code uses the functions setTimeout and clearTimeout respectively. Take note that window.clearTimeout() must be included in order for this to work. Otherwise, when the page loads, it closes it instantly. I read about what clearTimeout() is for, but I could not grasp how that is of use to the code to make the countdown timer work.

Once the page finishes loading due to the body tag’s onLoad event, the timer calls the timer() function and starts the countdown.

 

The code above closes the window in 5 seconds. If you need it for a few seconds more, just add 1 to the number of seconds till it reaches zero to the variable seconds.

Like what you see? Buy me a cup of coffee. Or subscribe to my feeds.


(No Ratings Yet)
 Loading ...