473,466 Members | 1,301 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem using DataGridViewCheckBoxColumn

Hi,

I am having problem using "DataGridViewCheckBoxColumn" in my project.
The function dgvCheckBox_Clicked is called when CheckBox in DataGrid is
clicked ( checked or unchecked).
dgvCheckBox_Clicked is fired by CellContentClick event on datagrid.

//Form1.Designer.cs
this.dataGridView1.CellContentClick += new
System.Windows.Forms.DataGridViewCellEventHandler( this.dgvCheckBox_Clicked);

However, I am getting "NullReferenceException was unhandled" is raised when
I click the CheckBox. :(

Here is the function I am using for test:

//called on Event: dataGridView1.CellContentClick
private void dgvCheckBox_Clicked(object sender,
DataGridViewCellEventArgs e)
{

//skip while form load
if (e.RowIndex == -1)
return;

if (e.ColumnIndex == 2) //CheckBox is the 3rd Column in DataGrid
{
if
((bool)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)
{
MessageBox.Show("Loaded");
}
else
MessageBox.Show("Unloaded");

}

I'll be really glad if someone can show me right direction.

thanks
Rojina
Nov 10 '07 #1
0 1987

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

Similar topics

7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
9
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
5
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
6
by: Bill | last post by:
I have an unbound DataGridView with a DataGridViewCheckBoxColumn as column 2(configured in the designer). How would I programatically set the checkbox state in, say, row 3 column 2? I need to do...
0
by: Sunday Oke | last post by:
hello I have a datagrid view with a DataGridViewCheckBoxColumn, and all I'm trying to do is use the "CellContentClick" toggle the check box on and off (or checked and unchecked) So far I...
1
by: baudenbacher | last post by:
Hi all, I´m using a System.Windows.Forms.DataGridView which first column is a DataGridViewCheckBoxColumn (.NET 2.0). My DataGridView is enabled to insert new rows. When a check the...
12
by: G.S. | last post by:
Is it acceptable to use { } blocks to improve readability and maintainability of the code? Example: //add the checkbox column DataGridViewCheckBoxColumn column = new...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
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...
1
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
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...
0
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...
0
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.