Solved

View all users from MembershipUserCollection in WinForm project

Posted on 2007-03-23
1
987 Views
Last Modified: 2013-11-07
I am using Membership classes in windows forms project. I am trying to create a form that would show all users with the following code :
MembershipUserCollection
usersCol = Membership.GetAllUsers();
this.dataGridView1.DataSource = usersCol;
However dataGrid is blank even thought the collection has 8 items.

Even when I try to grab a user like that :
user = usersCol["TestOut"];
this.dataGridView1.DataSource = user;

dataGrid is empty.  
What is the best way to display users in WinForm project.
0
Comment
Question by:psokolo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
Nico earned 500 total points
ID: 18807419
It's not possible to databind a MembershipUserCollection, since it's not implementing the necessary interfaces. You can bind it when you copy the items in the collection to a normal array. (or ArrayList or maybe even some others I suppose)

The following code works perfectly for me:

MembershipUserCollection users = Membership.GetAllUsers();
MembershipUser[] userArray = new MembershipUser[users.Count];
users.CopyTo(userArray, 0);
dataGridView1.DataSource = userArray;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question