11 Replies - 1644 Views - Last Post: 25 July 2008 - 08:48 AM Rate Topic: -----

#1 gayle111  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 19-May 08

Displaying Data on Form

Post icon  Posted 24 July 2008 - 05:59 AM

I have Visual Basic.Net 2008.

I would like to display a recordset on a forum something like this:


Item: White Shirt / mens Size: 16.5
Brand: Garjano Price: $56.50
Available Online: Yes In Stores: Yes
Current Stock: 43

Item: White Shirt / woman Size: 16.5
Brand: Garjano Price: 66.50
Available Online: Yes In Stores: Yes
Current Stock: 32

Item: Blue Shirt / mens Size: 16.0
Brand: Garjano Price: $56.50
Available Online: No In Stores: Yes
Current Stock: 3

Where each record makes up several lines, and if there are more than fit on one screen there would be a vertical scroll bar.

What component/object should I be looking at for displaying this kind of data on the form?

Is This A Good Question/Topic? 0
  • +

Replies To: Displaying Data on Form

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Displaying Data on Form

Posted 24 July 2008 - 09:19 AM

Moved to VB.NET where it will get the attention it deserves.

You could display the data in a Listbox.
Was This Post Helpful? 0
  • +
  • -

#3 gayle111  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 19-May 08

Re: Displaying Data on Form

Posted 24 July 2008 - 11:52 AM

View Postjayman9, on 24 Jul, 2008 - 09:19 AM, said:

Moved to VB.NET where it will get the attention it deserves.

You could display the data in a Listbox.


As far as I know listbox is one line per record. I have too much data to put on one line, I want to have several lines per data record.
Was This Post Helpful? 0
  • +
  • -

#4 kikz  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 32
  • Joined: 21-July 08

Re: Displaying Data on Form

Posted 24 July 2008 - 01:16 PM

If you want to display each field of each record on its own line you can subclass the DataGird or DataViewGrid controls to enable this. This would achieve similar functionality to using templates in ASP.NET repeater controls.

The DataGrid would contain only one column and you can subclass the cell to contain the 8 lables, 2 per line, to represent the field names and values.
Was This Post Helpful? 0
  • +
  • -

#5 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Displaying Data on Form

Posted 24 July 2008 - 01:37 PM

View Postgayle111, on 24 Jul, 2008 - 11:52 AM, said:

As far as I know listbox is one line per record. I have too much data to put on one line, I want to have several lines per data record.


I think you have been misinformed.

A ListBox displays multiple lines, hence the reference to List in the name of the control.

See the attached image displaying your data in a ListBox.

And yes, when the list grows longer a scrollbar will show up.

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#6 gayle111  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 19-May 08

Re: Displaying Data on Form

Posted 24 July 2008 - 01:48 PM

View Postjayman9, on 24 Jul, 2008 - 01:37 PM, said:

View Postgayle111, on 24 Jul, 2008 - 11:52 AM, said:

As far as I know listbox is one line per record. I have too much data to put on one line, I want to have several lines per data record.


I think you have been misinformed.

A ListBox displays multiple lines, hence the reference to List in the name of the control.

See the attached image displaying your data in a ListBox.

And yes, when the list grows longer a scrollbar will show up.



The image looks great. But is this data bound or do I need to fill it? Of course if fill it by hand I can do this, but I want it bound to the dataset so that I don't need to fill this each time.
Was This Post Helpful? 0
  • +
  • -

#7 gayle111  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 19-May 08

Re: Displaying Data on Form

Posted 24 July 2008 - 02:03 PM

View Postkikz, on 24 Jul, 2008 - 01:16 PM, said:

If you want to display each field of each record on its own line you can subclass the DataGird or DataViewGrid controls to enable this. This would achieve similar functionality to using templates in ASP.NET repeater controls.

The DataGrid would contain only one column and you can subclass the cell to contain the 8 lables, 2 per line, to represent the field names and values.


Well it's not that I want each field on a separate line, but in some cases I have a wide recordset (many fields) and putting it on a straight line like a typical DGV won't work (I don't want to pan right/left). So one row of the dataset would span several lines, laid out accordingly, depending on the data. I see this on the web a lot (I guess using ASP which I have never worked with, and I don't believe I can mix a ASP component with VB). Basically it's would be the same as an Access Continuos Form. But your mention of subclass sounds like it could do the job - but I think this is beyond my knowledge of vb.net. Is there an example or tutorial you can direct me to that should show me how to do this?
Was This Post Helpful? 0
  • +
  • -

#8 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Displaying Data on Form

Posted 24 July 2008 - 03:50 PM

View Postgayle111, on 24 Jul, 2008 - 01:48 PM, said:

The image looks great. But is this data bound or do I need to fill it? Of course if fill it by hand I can do this, but I want it bound to the dataset so that I don't need to fill this each time.

Yes, you can databind the dataset via the DataSource property.

However, if the results stored in the dataset are not exactly as you want them to be displayed already, then you will have to manually add them to the ListBox and format them as you add each line to the ListBox.
Was This Post Helpful? 0
  • +
  • -

#9 gayle111  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 19-May 08

Re: Displaying Data on Form

Posted 24 July 2008 - 04:48 PM

View Postjayman9, on 24 Jul, 2008 - 03:50 PM, said:

View Postgayle111, on 24 Jul, 2008 - 01:48 PM, said:

The image looks great. But is this data bound or do I need to fill it? Of course if fill it by hand I can do this, but I want it bound to the dataset so that I don't need to fill this each time.

Yes, you can databind the dataset via the DataSource property.

However, if the results stored in the dataset are not exactly as you want them to be displayed already, then you will have to manually add them to the ListBox and format them as you add each line to the ListBox.



So if I have a row of 12 fields I can bind it to a Listbox by binding the first three fields to line 1 of the listbox, the next three fields to the next line, etc. and then it will repeat itself automatically?
Was This Post Helpful? 0
  • +
  • -

#10 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Displaying Data on Form

Posted 24 July 2008 - 10:10 PM

If the data is stored in the DataSet exactly as you want it to appear visually, then you can simply bind it to the ListBox. Otherwise, you will need to manually add it to the Listbox while formatting the data to get the appearance you want.
Was This Post Helpful? 0
  • +
  • -

#11 gayle111  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 19-May 08

Re: Displaying Data on Form

Posted 25 July 2008 - 07:09 AM

View Postjayman9, on 24 Jul, 2008 - 10:10 PM, said:

If the data is stored in the DataSet exactly as you want it to appear visually, then you can simply bind it to the ListBox. Otherwise, you will need to manually add it to the Listbox while formatting the data to get the appearance you want.


so can you connect one row of a recordset to 3 rows on listbox - have it databound, not do this manually?
Was This Post Helpful? 0
  • +
  • -

#12 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Displaying Data on Form

Posted 25 July 2008 - 08:48 AM

No. As I already stated, twice now, if it needs to be listed in 3 rows then it needs to already be in 3 rows in the dataset. However, this is highly unlikely, especially if you are pulling the data from database.

You will need to manually add them to the ListBox. This is not a very difficult task.

Give it a try.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1