Hi All,
What want to do is;
disabled certain item in listBox.I want to disabled 2 items here.
listBox1.Items.Add(new ListItem { Name = "LocalMachine" });
listBox1.Items.Add(new ListItem { Name = "============" });
Here some code;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Abort_9
{
public partial class Form1 : Form
{
public class ListItem
{
public string Name { get; set; }
public override string ToString()
{
return Name;
}
}
const string runKey_ = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
const string runKey_A = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
const string runKey_B = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunServices";
const string runKey_C = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce";
const string runKey_D = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Userinit";
const string runKey1_ = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
const string runKey_AA = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
const string runKey_BB = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunServices";
const string runKey_CC = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunServicesOnce";
const string runKey_DD = "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows";
public Form1()
{
InitializeComponent();
listBox1.Items.Add(new ListItem { Name = "LocalMachine" });
listBox1.Items.Add(new ListItem { Name = "============" });
listBox1.Items.Add(new ListItem { Name = runKey_ });
listBox1.Items.Add(new ListItem { Name = runKey_A });
listBox1.Items.Add(new ListItem { Name = runKey_B });
listBox1.Items.Add(new ListItem { Name = runKey_C });
listBox1.Items.Add(new ListItem { Name = runKey_D });
listBox1.Items.Add(new ListItem { Name = "" });
listBox1.Items.Add(new ListItem { Name = "CurrentUser" });
listBox1.Items.Add(new ListItem { Name = "============" });
listBox1.Items.Add(new ListItem { Name = runKey1_ });
listBox1.Items.Add(new ListItem { Name = runKey_AA });
listBox1.Items.Add(new ListItem { Name = runKey_BB });
listBox1.Items.Add(new ListItem { Name = runKey_CC });
listBox1.Items.Add(new ListItem { Name = runKey_DD });
}

