M
Manikandan
Hi,
I have a listview items with checkbox .
I want the checbox to be checked or unchecked when the user clicks the
listview items or check box.
When i click the checkbox for list view item, it is not checked.
But if i select the listview items by mouse click, the checkbox is
checked.
I want the user to select the items by checking the checkbox in
lisview
I written the code in listview mouse down a
private void listview1_MouseDown(object sender, MouseEventArgs e)
{
ListViewItem oLVitem;
if(e.Button == MouseButtons.Left)
{
oLVitem = this.listview1.GetItemAt(e.X, e.Y);
int t=oLVitem.Index;
if (oLVitem != null)
{
if (oLVitem.Checked == true)
{
//oLVitem.Checked = false;
listview1.Items[oLVitem.Index].Checked=false;
}
else
{
//oLVitem.Checked = true;
listview1.Items[oLVitem.Index].Checked=true;
}
}
}
}
I tried the above for checking the checkbox in listview when user
click the checbox.
It is not working, is there any problem in the code
Thanks,
Mani
I have a listview items with checkbox .
I want the checbox to be checked or unchecked when the user clicks the
listview items or check box.
When i click the checkbox for list view item, it is not checked.
But if i select the listview items by mouse click, the checkbox is
checked.
I want the user to select the items by checking the checkbox in
lisview
I written the code in listview mouse down a
private void listview1_MouseDown(object sender, MouseEventArgs e)
{
ListViewItem oLVitem;
if(e.Button == MouseButtons.Left)
{
oLVitem = this.listview1.GetItemAt(e.X, e.Y);
int t=oLVitem.Index;
if (oLVitem != null)
{
if (oLVitem.Checked == true)
{
//oLVitem.Checked = false;
listview1.Items[oLVitem.Index].Checked=false;
}
else
{
//oLVitem.Checked = true;
listview1.Items[oLVitem.Index].Checked=true;
}
}
}
}
I tried the above for checking the checkbox in listview when user
click the checbox.
It is not working, is there any problem in the code
Thanks,
Mani