C# Comment puis-je obtenir mon article listbox et l'ajouter rapidement quand je pressais checklistboxes
Bonjour Je suis confonds encore à ce comment puis-je obtenir mes articles listbox et quand je clique tous checklistboxes et je veux ajouter la numéros et afficher dans la zone de texte. par exemple je vérifie l'index de checklistbox 1 qui contient 300 l'affiche dans la zone de texte. Puis je vérifie aussi mon index 2 de checkboxlist contient 100 puis il affiche 400. Puis si je vérifie mon index 3 de ma checkboxlist contient 200 il affiche 600 dans la case à cocher.
Mon code:
namespace ggg
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
listBox1.Items.Clear();
listBox2.Items.Clear();
textBox1.Clear();
foreach (string s in checkedListBox1.CheckedItems)
listBox1.Items.Add(s);
foreach (int i in checkedListBox1.CheckedIndices)
{
if (i == 0)
{
listBox2.Items.Add(300);
decimal total = 300;
textBox1.Text += total;
}
if (i == 1)
{
listBox2.Items.Add(100);
decimal total = 100;
textBox1.Text += total;
}
if (i == 2)
{
listBox2.Items.Add(200);
decimal total = 200;
textBox1.Text += total;
}
}
}
}
}
qu'avez-vous fait, vous devez faire un effort –
je ne peux pas poster mon code wait –
@gencklavyeler fait monsieur –