473,671 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(B yVal sender As Object, ByVal e As
System.EventArg s) Handles clickme.Click
Dim ss As MetaFrameSessio n
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" , "Disconnect ed", "Idle", "Listening" , "Resetting" ,
"Down", "Init"}
For Each ss In thefarm.Session s
If ss.UserName = username Then
sessionarray.se ssionid = ss.SessionID
sessionarray.se rvername = ss.ServerName
sessionarray.ap pname = ss.AppName
sessionarray.se ssionstate = state(ss.Sessio nState)
sessionarray.cl ientbuild = ss.ClientBuild
sesslist.Add(se sslist)
End If
Next
'this is where the data needs to be populated.
GridView1.DataS ource = sesslist
GridView1.????? ?????
End Sub

Dec 26 '07 #1
1 3265
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
14030
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.) The technical requirements: 1) Store tree data in the database so that it can be extracted as a tree structure. For test purposes,
7
2079
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 how I might modify a structure in an arraylist without having to completely remove it and re-add the structure to the arraylist? I just want to iterate throught the arraylist and change items based on certain conditions. Thanks in advance!
3
6036
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 "LabLocation_ID". With an existing lab, they then need to add the members for that lab. So, what I am trying to do is the following. With the FormView of the Lab open, the user will click a button to open a FormView (InsertMode) and add a new...
3
15298
by: needin4mation | last post by:
In this code: protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView rowView = (DataRowView)e.Row.DataItem; // Retrieve the value for the current row.
1
10602
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 user enters another ID. The code to get the data back is below and it works and I am returning an ArrayList. I get an error when I bind the gridview control: -- A field or property with the name 'ItemName' was not found on the selected data...
3
10270
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 does not change, and in the updated and updating row events the newValues collections are empty!!! I've tried various other methods such as using an ObjectDataSource, but my ArrayList does not existing in a database until after the editing and...
5
2646
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 simply working with objects in memory. So, it appears as though Microsoft requires that our datamapper classes reside inside a folder called "App_Code", and NO WHERE ELSE. So, has anyone successfully been able to place their datamappers in a...
0
1688
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 SQL statements in the Data Acess Layer to create more secure web service application. The Web service class is also in the Data Access Layer. I need to populates the 4 Dropdown list boxes on the web form from one table. I have Customer table which...
1
3188
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. Count, IsReadOnly etc. Any ideas how I can get it to bind to the gridview showing the correct values? Code below.
0
8919
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8599
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8670
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4409
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2813
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2052
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.