.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 7th, 2003, 04:09 PM
Bartman Bartman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 6 Bartman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 14 sec
Reputation Power: 0
Question Writing to a listbox

I am a newbie to C#, and am working on a small project of creating a Windows application that has a textbox in which the end user enters a numerical amount. There are two buttons---one adds the inputted amount to a total, and the other subtracts the amount from the total. The total is displayed as a label.

I am trying to create a transaction log that records the numerical amount and type (add, subtract) of each entry. I would prefer to record each log entry in its own row within a single table, and use a scrollbar should the entry list become large.

Would a listbox be the best way of going about doing this? How would I be able to add data to a listbox (aside from pre-entering everything in the "String Collection Editor?" If not, which would be the optimal component to use for this?

Last edited by Bartman : December 7th, 2003 at 04:12 PM.

Reply With Quote
  #2  
Old December 9th, 2003, 12:52 PM
dkode dkode is offline
PHP/PERL/.NET Coder
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Daytona Beach, Florida
Posts: 36 dkode User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 sec
Reputation Power: 8
Send a message via AIM to dkode
this might be a little overkill but here we go:

First thing is, will you have to retrieve these values after the user exits and re-enters the application?

Theres a couple of different ways you could do this:

1) This would require access to a SQL database. Simply insert a new row with a unique id each time the user adds an entry, then grab the table into a dataset and attach the dataset to the listbox.

2) Store the entries in a new Dataset, persist the dataset to xml so the file can be stored on the users local machine, then attach the dataset to the listbox like option 1. this is the same as option 1 except a sql server wouldn't be required, but then the changes are only local to that users machine.

3) create a custom object named something like myEntry. this class would have properties like :
Value (the value they entered)
Action (this would be either add or subtract)

then store all of these objects into an arraylist. You can then bind the arraylist to the listbox.

I would recomend not just adding the text value to the listbox as this leaves little room for scalability, but if you don't expect this app to change much at all you can just add the value to the listbox item collection when they click the button.

You get the idea.
__________________
"Mankind cannot define memory, yet it defines mankind"

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Writing to a listbox


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT