Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Web.Services;
 
namespace CatalogAdmin
{
    public partial class Form1 : Form
    {
        private String m_sEmailValidating;
        public Form1()
        {
            InitializeComponent();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            AsyncCallback oCallBack = new AsyncCallback(MyCallBack);
            // Consommation du WebService
            ValidateEmail oEmailValidator = new ValidateEmail();
            m_sEmailValidating = textBox2.Text;
            IAsyncResult Response = oEmailValidator.BeginIsValidEmail(m_sEmailValidating, oCallBack, oEmailValidator);
            textBox1.Text = "Validating " + m_sEmailValidating + " eMail";
            Response.AsyncWaitHandle.WaitOne();
        }
 
        private void MyCallBack(IAsyncResult Response)
        {
            ValidateEmail oWebService = (ValidateEmail) Response.AsyncState;
            bool bValue = oWebService.EndIsValidEmail(Response);
            if (bValue)
            {
                textBox1.Text = m_sEmailValidating + " is good";
            }
            else
            {
                textBox1.Text = m_sEmailValidating + " is bad";
            }
        }
    }
}
Lorsque je test ce code, le texte "Validating ... " s'affiche au bout d'un certain moment et lors de l'arrivée de la réponse, le texte comme quoi l'email est valide ou non ne s'affiche pas, je reste sur le "Validating..."
Pourtant je passe bien par le code.
Quelqu'un aurait une idée de ce qui pourrait bloquer ?

Merci d'avance