473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

populating gridview using arraylist of structure

I am trying to understand how to use an arraylist that contains data in a
structure and bind the results to a gridview. Using vs2008

I have looked at the examples
315784 HOW TO: Bind a DataGrid Control to an Array of Objects or Structures by
http://support.microsoft.com/?id=315784

316302 HOW TO: Bind a DataGrid Control to an ArrayList of Objects or
Structures
http://support.microsoft.com/?id=316302

These examples are incomplete or are very confusing as they start out by
creating a class or stucture of guitar and then talk about currency something
in the end.

below is my sample code.

Public Structure userinfo
Dim sessionid As Integer
Dim servername As String
Dim appname As String
Dim sessionstate As String
Dim clientbuild As Integer
End Structure
Private Sub clickme_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles clickme.Click
Dim ss As MetaFrameSession
Dim username As String = "gbaham"
Dim sessionarray As userinfo
sessionarray = New userinfo
Dim sesslist As ArrayList
sesslist = New ArrayList
Dim state As String()
state = New String() {"Unknown", "Active", "Connected",
"Connecting", "Shadowing", "Disconnected", "Idle", "Listening", "Resetting",
"Down", "Init"}
For Each ss In thefarm.Sessions
If ss.UserName = username Then
sessionarray.sessionid = ss.SessionID
sessionarray.servername = ss.ServerName
sessionarray.appname = ss.AppName
sessionarray.sessionstate = state(ss.SessionState)
sessionarray.clientbuild = ss.ClientBuild
sesslist.Add(sesslist)
End If
Next
'this is where the data needs to be populated.
GridView1.DataSource = sesslist
GridView1.??????????
End Sub

Dec 26 '07 #1
1 3253
Jay,

Don't assume that the DataGrid or DataGridView is the same as a GridView, it
is as equal with that as a plane to a car.

I think that you find on the page bellow enough to reach your goal.

http://msdn2.microsoft.com/en-us/library/ms752213.aspx

Cor

Dec 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Johnson | last post by:
Been banging my head on this for two days now. Hope someone can help! My test program below is in the form of a single JSP, with a Node class build in. (All the coded needed to run is below.) ...
7
by: Adam | last post by:
Hi all, In my VB.NET code below, I try to change the user name in my arraylist from Ted to Bob, but instead it adds a new user to the arraylist named Bob. Can anyone explain why this happens and...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
3
by: needin4mation | last post by:
In this code: protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView rowView =...
1
by: Mike Collins | last post by:
I've seen how to set up a gridview at design time, but I believe I need to do this and run time and cannot figure it out. I am sending a concatenated list of IDs that is gets bigger each time a...
3
by: pblack9455 | last post by:
I have a simple requirement to bind a small ArrayList of (ItemLine) Objects to a GridView control. The Gridview renders on the page and allows me to click update/edit buttons...however the data...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
0
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my...
1
by: nomad | last post by:
Hi, I have a two dimensional arraylist below, which I am trying to bind to a gridview. However, when I try and do this the gridview is being populated with what looks like property values i.e....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.