/// <summary> /// Obter a lista de utilizadores /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnGetUsers_Click(object sender, EventArgs e) { using (AuthServiceClient service = new AuthServiceClient()) { var users = service.GetUsers(txtLogin.Text, txtPassword.Text); if (users != null) { lboxUsers.DataSource = users; lboxUsers.DisplayMember = "Name"; lboxUsers.ValueMember = "Login"; } else { MessageBox.Show("Something went wrong while getting users."); lboxUsers.DataSource = null; } } //// versão 1 //lboxUsers.DataSource = users; //lboxUsers.DisplayMember = "Name"; //lboxUsers.ValueMember = "Login"; //// versão 2 //lboxUsers.Items.Clear(); //foreach (User user in users) //{ // lboxUsers.Items.Add(user.Login); //} }