TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
alec
NA
86
57.5k
datagridviewcheckboxcolumn problem getting value
Dec 9 2011 7:03 AM
I'm sure everyone has had enough of my posts but these datagridviews are giving me so much hassle! I have three of them that are used for data collection to do a filtered search of a database. each one has two columns left is a list of manufactures, suppliers or categories the right is checkbox column and I have the code below that is used to form a string of all the entries on the left who were checked in the right column. but it fails and says "object reference not set to an instance of an object"
//manufacturer filter used as example
if (checkBoxManufacturerFilter.Checked == true) //this combobox isn't in the table its just to indicate weather this filter should be applyed or not
{
if (FirstFilter == false)
{
FilteredSearchQuery = FilteredSearchQuery + "and ";
}
string ManufacturerList = string.Empty;
foreach (DataGridViewRow row in DGVmanufacturerFilter.Rows)
{
if ((bool)row.Cells[1].Value == true)
{
ManufacturerList = ManufacturerList + "," + (string)row.Cells[0].Value;
}
}
if (ManufacturerList.Length > 0)
{
if (ManufacturerList.Substring(0, 1) == ",")
{
ManufacturerList = ManufacturerList.Substring(1);
}
}
ManufacturerList = "(" + ManufacturerList + ")";
string ManufacturerFilterClause = "manufacturer in " + ManufacturerList + " ";
FilteredSearchQuery = FilteredSearchQuery + ManufacturerFilterClause;
if (FirstFilter == true)
{
FirstFilter = false;
}
}
Reply
Answers (
1
)
OLEDBReader Porblem
Telerik Control