Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 22nd, 2005, 02:51 AM
Registered User
 
Join Date: Aug 2004
Location: pune, maharashtra, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to belzicool
Default binding arraylist of structures to data grid in C#

Hi,
I am writing a small application in C#. I have a structure called
public struct QXF_data
     {
      public string source;
      public string target;
     }

I want to create an arraylist of these structures and bind it to a data grid in C#.

        ArrayList QXFlist = new ArrayList();
    QXF_data qdata1 = new QXF_data();
    qdata1.source="a";
    qdata1.target="b";

        QXF_data qdata2 = new QXF_data();
    qdata1.source="c";
    qdata1.target="d";
        QXFlist.Add(qdata1);
    QXFlist.Add(qdata2);

I am doing this by simply setting the data source of the grid to the arraylist.
    dataGrid1.DataSource = QXFlist;

But the result is not what i expect. (actually the grid is blank)

I want the result as

    SOURCE TARGET
1. a b
2. c d


I am new with C# and need some help with this.
Can anyone please help me with this?
Thanx a lot in advance.
--
Nikhil
 
Old May 9th, 2007, 11:58 PM
Registered User
 
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you need to call dataGrid1.DataBind() method as well





Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView binding with Arraylist myself.panku .NET Framework 2.0 2 November 5th, 2008 05:52 AM
data structures problems detence C++ Programming 1 April 11th, 2007 11:27 AM
data structures silvia C# 4 January 19th, 2006 04:25 AM
Complex Data Structures misterqj General .NET 2 March 19th, 2005 04:40 AM
data structures in C# Xanoo C# 4 July 1st, 2004 03:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.