473,406 Members | 2,371 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,406 software developers and data experts.

Populating a datagrid ... how is it done normally?

Hi All ...

I'm writing a small shopping cart app (school assignment) and need to list
all the books that a user selects.

I have created a "BookBasket" object that contains among other things an
arraylist of the user selected books. The "book" object contains isbn,title
price and quantity information.

I'd like to display the contents of the BookBasket in a datagrid control.

I assume that to start with I'd have to iterate through the basket to
identify each books information, but then how do I populate the datagrid
from there?

It seems from what I've read,that it is easier to populate a datagrid from a
datasource, but I don't know how that would relate to what I'm doing.

any clues or links to examples would be much appreciated.

Thanks in advance

Prime.


Nov 18 '05 #1
2 1314
Prime,
There is a plethora of examples on using a datagrid control. Search
google and you will find more than you need. The second article outlines
what kind of datasources a datagrid will accept, an array is a valid data
source so you won't have to write any code to fill another control. The
third snippit supports my last statement.
Hope this helps.
Jared

Here's one to get you started
http://samples.gotdotnet.com/quickst..._datagrid.aspx

http://msdn.microsoft.com/library/de...adodataset.asp

You can bind to the following structures if their elements expose public
properties:

a.. Any component that implements the IList interface. This includes
single-dimension arrays

"Prime" <no*@real.address> wrote in message
news:uI**************@TK2MSFTNGP14.phx.gbl...
Hi All ...

I'm writing a small shopping cart app (school assignment) and need to list
all the books that a user selects.

I have created a "BookBasket" object that contains among other things an
arraylist of the user selected books. The "book" object contains
isbn,title
price and quantity information.

I'd like to display the contents of the BookBasket in a datagrid control.

I assume that to start with I'd have to iterate through the basket to
identify each books information, but then how do I populate the datagrid
from there?

It seems from what I've read,that it is easier to populate a datagrid from
a
datasource, but I don't know how that would relate to what I'm doing.

any clues or links to examples would be much appreciated.

Thanks in advance

Prime.

Nov 18 '05 #2
Hi Jared,

I think you've helped me before ... thank-you again.

I found the gotdotnet sample very helpful. We are currently using a text
book that is poor by any standard so your assistance is very much
appreciated.

The second sample was good, but we're not allowed to use a database
interface! I originally coded my app that way,but was told that it was
unacceptable. :( I found the database version extremely simple to code.)

Again, thanks for you assistance.

Prime.

"Jared" <as***********@nospam.com> wrote in message
news:10*************@corp.supernews.com...
Prime,
There is a plethora of examples on using a datagrid control. Search
google and you will find more than you need. The second article outlines
what kind of datasources a datagrid will accept, an array is a valid data
source so you won't have to write any code to fill another control. The
third snippit supports my last statement.
Hope this helps.
Jared

Here's one to get you started
http://samples.gotdotnet.com/quickst..._datagrid.aspx
http://msdn.microsoft.com/library/de...adodataset.asp
You can bind to the following structures if their elements expose public
properties:

a.. Any component that implements the IList interface. This includes
single-dimension arrays

"Prime" <no*@real.address> wrote in message
news:uI**************@TK2MSFTNGP14.phx.gbl...
Hi All ...

I'm writing a small shopping cart app (school assignment) and need to list all the books that a user selects.

I have created a "BookBasket" object that contains among other things an
arraylist of the user selected books. The "book" object contains
isbn,title
price and quantity information.

I'd like to display the contents of the BookBasket in a datagrid control.
I assume that to start with I'd have to iterate through the basket to
identify each books information, but then how do I populate the datagrid
from there?

It seems from what I've read,that it is easier to populate a datagrid from a
datasource, but I don't know how that would relate to what I'm doing.

any clues or links to examples would be much appreciated.

Thanks in advance

Prime.


Nov 18 '05 #3

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

Similar topics

1
by: MrB | last post by:
I am quite new to vb.net. I have been using VBA for years, but an having problems with populating a listview. I have tried many things, including snippets of code from some news groups with no...
2
by: Robert | last post by:
I'm sure this is a fairly basic question, but I've been looking all over the web for days for suggestions on how to do this. I've got a datagrid that's bound to a dataset on my form. It includes...
4
by: Paul | last post by:
I sometimes get a timeout error when populating my datagrid, the code is WizardConnection.Open() UpdateCommand.CommandText = "EXECUTE sp_assign_user '" & PhysOffice.SelectedValue & "', '" &...
5
by: | last post by:
Trying to learn about manipulating collections of objects, and populating these objects dynamically from datasources. Could someone post a code sample that shows the following: Instantiating a...
6
by: coleenholley | last post by:
Hi All :-) I need to populate a table I created as a web form. Are there any links to show me how to do this? I CANNOT use a dtagrid for this, the table has to be laid out as follows: Header...
7
by: coleenholley | last post by:
Hi all :-) I have a couple of web pages created using ASP.Net and VB code-behind. We use a connection call through an RPC to COBOL, NOT an SQL connection, so my connection to get the data is done...
6
by: fripper | last post by:
I want to populate the cells of a DataGrid at run time. I don't want to bind a database to it I simply want to do some calculations and put results into the grid programmatically. I did this in...
1
by: Mike P | last post by:
I am populating a drop down column in a datagrid on page load. Here is my code : <asp:TemplateColumn> <ItemTemplate> <asp:DropDownList ID="ddlUserName" Font-Name="Verdana" Font-Size="8pt"...
8
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.