CheckList event handeler problems

Apr 8 2010 11:57 AM

Hi, um so I have this checklistbox that has some checkboxes in it using VisualStudio 2005 C#.net and I am making a moble app to allow only one checkbox to be checked at one time. I have gotten the idea of how it should be done but I hit a snag that i did. I know I need to have the checkstate but I dont know how to get it into my code. It is rather dounting that it is. Well here is the code if anyone can help me the problem is down at the bottom that it is with this method
private void deleteToDoItemsView1_Click(object sender, EventArgs e)
 

using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
namespace
ToDoListWM5
{
public partial class Form1 : Form
{
private Model toDoListModel;

public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
toDoListModel =
new Model();
this.deleteToDoItemsView1.ViewData = toDoListModel.ToDoListViewData;
this.deleteToDoItemsView1.Visible = true;
this.addToDoItemView1.Visible = false;
}
private void menuItem2_Click(object sender, EventArgs e)
{
switch (((MenuItem)sender).Text)
{
case "Delete":
{
toDoListModel.DeleteToDoListItems(
this.deleteToDoItemsView1.ViewItemsToDelete);
this.deleteToDoItemsView1.ViewData = toDoListModel.ToDoListViewData;
this.menuItem1.Text = "Add";
this.menuItem2.Text = "Delete";
this.deleteToDoItemsView1.Visible = true;
this.addToDoItemView1.Visible = false;
break;
}
case "OK":
{
toDoListModel.AddToDoListItem(
this.addToDoItemView1.ViewItemToAdd);
this.deleteToDoItemsView1.ViewData = toDoListModel.ToDoListViewData;
this.menuItem1.Text = "Add";
this.menuItem2.Text = "Delete";
this.deleteToDoItemsView1.Visible = true;
this.addToDoItemView1.Visible = false;
break;
}
}
}
private void menuItem1_Click(object sender, EventArgs e)
{
switch (((MenuItem)sender).Text)
{
case "Add":
{
this.addToDoItemView1.ViewData = toDoListModel.ToDoListViewData;
this.menuItem1.Text = "BACK";
this.menuItem2.Text = "OK";
this.deleteToDoItemsView1.Visible = false;
this.addToDoItemView1.Visible = true;
break;
}
case "BACK":
{
this.deleteToDoItemsView1.ViewData = toDoListModel.ToDoListViewData;
this.menuItem1.Text = "Add";
this.menuItem2.Text = "Delete";
this.deleteToDoItemsView1.Visible = true;
this.addToDoItemView1.Visible = false;
break;
}
}
}
//add code here to make sure that one checkbox thingy is check only
private void deleteToDoItemsView1_Click(object sender, EventArgs e)
{
if (CheckState = checked){
this.deleteToDoItemsView1.ViewItemsToDelete.RemoveToDoListRow();

}



}
}
}
 

Answers (2)