Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Apr 2004
    Location
    Lancaster, Pennsylvania
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Best way to display columns of info (VB.net)

    Hi all,

    I am trying to learn VB.net, and I am currently writing my first program. I am using visual studio 2003.

    In my application, I create an arraylist of one type of objects. The objects have 4-5 properties (fields) that I would like to display for the user in columns (like a spreadsheet). I could have anywhere between 1 and a hundred thousand objects to display. What is the best way to display them?

    So far, I have been using a text box, and manipulating strings to try to match certain lengths, and then using vbTab to try to move to the next column. Not only is this method awkward, but it isn't always effective. Also, I thought about using the Office Spreadsheet activeX control, but it can only hold 65-thousand-ish records.

    Is there a better way to display my objects without creating a table and using a datagrid (I'm probably avoiding the right way because it seems difficult)?

    Any advice would be very appreciated.

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Best way to display columns of info (VB.net)

    This is not a direct answer to your question (a datagrid seems like a reasonable response to that) but I would strongly question the rationale behind displaying a hundred thousand of anything to a user, as I don't see what on earth you could expect them to do with that information. Can you elaborate on what the purpose of this application is?
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    New Lounger
    Join Date
    Apr 2004
    Location
    Lancaster, Pennsylvania
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Best way to display columns of info (VB.net)

    Thank you both for your helpful responses.

    Alan - While the Teroid Grid Control looks like it would suite my needs exactly, sadly, it was unavailable when I clicked on "download". Perhaps the file was removed. Either way, I will enjoy looking through the free downloads.

    Rory- The application is more of a way for me to learn VB.net than anything that I would distribute, but I'd be happy to share with you about what it does. The application searches computers, drives, or folders, as specified by the user, and the returns all of the files in the selected region. Then, the user is able to sort by the files size, and the last date that it was used to determine if they have excess garbage that they can get rid of. In addition to "drive clean-up", the application can also serves a purpose as a cataloging utility (ex: user has a large picture or music collection, and would like a way to see what all they have). Anyway, thanks for the response. Perhaps a datagrid is the right choice.

    Best Regards,

    Andy

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Best way to display columns of info (VB.net)

    Bummer <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15>. Looks like it's <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18> to the rescue again - try here.

    Alan

  6. #6
    New Lounger
    Join Date
    Apr 2004
    Location
    Lancaster, Pennsylvania
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Best way to display columns of info (VB.net)

    Alan,

    Thanks again! The control is just what I was looking for... and it free! Not only that, but it came with a decent help file, and seems easy to use.
    I really appreciate your help.

    -Andy

  7. #7
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Best way to display columns of info (VB.net)

    And thanks for the heads up. I'll grab one myself once I get round to installing .NET.

    Alan

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Best way to display columns of info (VB.net)

    You needn't create a table at all, since datagrids are capable of being bound to a dataset, but why would you create such large arraylists? Just being able to display the data doesn't justify the overhead of doing so in the way you describe. <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>
    Charlotte

  9. #9
    New Lounger
    Join Date
    Apr 2004
    Location
    Lancaster, Pennsylvania
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Best way to display columns of info (VB.net)

    Thanks for your input Charlotte. Because I'm such a newb, I am actually very open to suggestions. I think that the potentially large arraylist comes at a very large performance cost too. It pretty much slows my PC to a halt. There must be a better way. What would be a better practice? What do you reccommend?

    One thought that I had, and have actually tested, is writing the data into a random access file, and then pulling the information onto the form several lines at a time, and then allowing the user to scroll through the information. This way, all of the data is not in memory at the same time. Is this similar to what you had in mind? Or were you thinking of using a different collection?

    By the way, I'm going to look into datasets too. It might be easier to use that grid than I thought.

    Thanks in advance for your guidance. (And also to any other experts who might have comments)

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Best way to display columns of info (VB.net)

    You haven't explained exactly what you're trying to do in this application, so it's hard to advise you. You could store the data in a text file, but an xml file would be a better choice, since it can be read directly into an XMLReader which can be used to fill the dataset. An XML file can contain the data and the structure (table names and attributes, field names and attributes, etc.), or you can use an Access database as the data store. It really depends on the nature of the project and what you're familiar with.
    Charlotte

  11. #11
    New Lounger
    Join Date
    Apr 2004
    Location
    Lancaster, Pennsylvania
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Best way to display columns of info (VB.net)

    It sounds like my real issue is not only which controls are available for my application to consume, but more importantly, how much memory is it acceptable for an application to demand.

    Charlotte, I really like your your xml idea, because it sounds very automated when compared with the technique that I have been using. Currently, I have been using a random access file with a new record for each record, and a delimiter between each of the fields. XML would probably require less code to read, but I guess I already wrote the code required. Either way, I think the answer to my performance problem is the hard drive. I guess I don't need to pull all of my records into memory if my user can only view a few at a time anyway.

    By the way, does anyone have a good rule of thumb to use about when it's OK, and when it's not OK to request memory? ...any guidelines about when to limit memory consumption?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •