Ajouter les ville a une listbox a partir d'autre listbox
Fermé
salma ritaje
Messages postés
8
Date d'inscription
samedi 13 avril 2013
Statut
Membre
Dernière intervention
21 mai 2013
-
13 avril 2013 à 22:09
salma ritaje Messages postés 8 Date d'inscription samedi 13 avril 2013 Statut Membre Dernière intervention 21 mai 2013 - 14 avril 2013 à 03:03
salma ritaje Messages postés 8 Date d'inscription samedi 13 avril 2013 Statut Membre Dernière intervention 21 mai 2013 - 14 avril 2013 à 03:03
A voir également:
- Ajouter les ville a une listbox a partir d'autre listbox
- Creer un groupe whatsapp a partir d'un autre groupe - Guide
- Recherche à partir d'une image - Guide
- Trouver un nom à partir d'une adresse ✓ - Forum Loisirs / Divertissements
- Ajouter une adresse mail - Guide
- Annuaire portable gratuit a partir d'un nom ✓ - Forum Mobile
6 réponses
salma ritaje
Messages postés
8
Date d'inscription
samedi 13 avril 2013
Statut
Membre
Dernière intervention
21 mai 2013
14 avril 2013 à 01:32
14 avril 2013 à 01:32
oui et je ne sais pas commente on va afficher un message quand la listbox2 avait déjà la ville
o_O
Structure Conditionnelle ....
+ API MessageBox
Structure Conditionnelle ....
+ API MessageBox
MessageBox.Show ("Liste2 possède déjà cette entité !!", "Erreur", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
salma ritaje
Messages postés
8
Date d'inscription
samedi 13 avril 2013
Statut
Membre
Dernière intervention
21 mai 2013
14 avril 2013 à 02:01
14 avril 2013 à 02:01
je voudrais la conditionne qui m'aide pour afficher ce message moi j'ai fait ca mais je ai pas bien réussis
private void button1_Click_1(object sender, EventArgs e)
{
for (int i=0;i<this.listBox2.Items.Count ;i++ )
if (this.listBox1.SelectedItem == this.listBox2.Items)
{
MessageBox.Show("errour");
}
if (this.listBox1.SelectedItem != this.listBox2.Items)
{
listBox2.Items.Add(listBox1.SelectedItem);
listBox1.Items.Remove(listBox1.SelectedItem);
}
}
private void button1_Click_1(object sender, EventArgs e)
{
for (int i=0;i<this.listBox2.Items.Count ;i++ )
if (this.listBox1.SelectedItem == this.listBox2.Items)
{
MessageBox.Show("errour");
}
if (this.listBox1.SelectedItem != this.listBox2.Items)
{
listBox2.Items.Add(listBox1.SelectedItem);
listBox1.Items.Remove(listBox1.SelectedItem);
}
}
salma ritaje
Messages postés
8
Date d'inscription
samedi 13 avril 2013
Statut
Membre
Dernière intervention
21 mai 2013
14 avril 2013 à 02:31
14 avril 2013 à 02:31
et j'ai fait aussi autre solution avec une variable string et sa marche pas
private void button1_Click(object sender, EventArgs e)
{
// Set the search string:
string myString = listBox1.SelectedItem.ToString();
// Search starting from index -1:
int index = listBox1.FindString(myString, -1);
if (index != -1)
{
// Select the found item:
listBox1.SetSelected(index, true);
// Send a success message:
//MessageBox.Show("Found the item \"" + myString +
// "\" at index: " + index);
listBox2.Items.Add(listBox1.SelectedItem);
listBox1.Items.Remove(listBox1.SelectedItem);
}
else
MessageBox.Show("Item not found.");
}
avait vous compris ce que je voudrais dire ???
private void button1_Click(object sender, EventArgs e)
{
// Set the search string:
string myString = listBox1.SelectedItem.ToString();
// Search starting from index -1:
int index = listBox1.FindString(myString, -1);
if (index != -1)
{
// Select the found item:
listBox1.SetSelected(index, true);
// Send a success message:
//MessageBox.Show("Found the item \"" + myString +
// "\" at index: " + index);
listBox2.Items.Add(listBox1.SelectedItem);
listBox1.Items.Remove(listBox1.SelectedItem);
}
else
MessageBox.Show("Item not found.");
}
avait vous compris ce que je voudrais dire ???
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionfor (int i=0;i<this.listBox2.Items.Count ;i++ ) listBox2.SetSelected(i, True); if (this.listBox1.SelectedItem == this.listBox2.SelectedItem) { MessageBox.Show ("Liste2 possède déjà cette entité !!", "Erreur", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); return 0; } listBox2.SetSelected(i, False);
Quelque chose comme ça ?
salma ritaje
Messages postés
8
Date d'inscription
samedi 13 avril 2013
Statut
Membre
Dernière intervention
21 mai 2013
14 avril 2013 à 03:03
14 avril 2013 à 03:03
oui merci bcp ça marche quand la listbox2 deja vu la ville mais ca marche pas quand la listbox2 ne contienne pas cette ville ( ne rajoute pas cette ville )