944,142 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1677
  • VB.NET RSS
Aug 14th, 2007
0

Visual Basic Help

Expand Post »
Hello, i need to make a major project in Visual Basic.Net. My project idea was to make a program that tells me the value of a persons assets (and hence how rich you are ), provided you enter in data for such things as cars, house, credit cards etc.

The question is how could i implement such an idea into a program and if it is too simplistic/too complicated for a beginner programmer like myself, if complicated can anyone suggest other original ideas for a major project, thanks would be great help.

From ajaytee.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ajaytee is offline Offline
6 posts
since Feb 2007
Aug 14th, 2007
0

Re: Visual Basic Help

hai ajaytee,
take 4 txtboxes(4 car,house,credit card& name)& button to calculate his/her assets...u can calculate assets by addin all of them.store the result in database& compare value of all persons assets(dependin on values rate them..)thats it!!
The idea is very simplified(its good 4 beginner)-keep goin& try to solve the errors by urself -or take help of the forums& google(dont ask for others-manually)...Once u pass this stage then u can get the confidence(dont worry for all the technical prblms-google will hlp u or become member in p2p.wrox.com,daniweb,asp.net(forums)....
Reputation Points: 5
Solved Threads: 1
Junior Poster in Training
preetham.saroja is offline Offline
82 posts
since Jun 2007
Aug 14th, 2007
0

Re: Visual Basic Help

Hey if i didnt want to use a database to store the data, would i need to use an array of some sort?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ajaytee is offline Offline
6 posts
since Feb 2007
Aug 14th, 2007
0

Re: Visual Basic Help

If you dont want to use databse to store data then you have other options too.
- You can use an XML file which can easily parsed.
- You can aslo try .dat or txt files

You can use array to fetch the records saved in these files or database but you can't save directly to arrays as they are virtual objects.
You need a physical storage to store and retrive the data.
Reputation Points: 25
Solved Threads: 18
Practically a Master Poster
binoj_daniel is offline Offline
645 posts
since Dec 2006
Aug 14th, 2007
0

Re: Visual Basic Help

A database just makes sure the data persists between runs of the program. If you set up all of your assets and then close the program, the assets are stored somewhere on your hard drive so that when you run the program again, everything is still the same as when you closed it.

You don't have to use a database to do that, but if there's a lot of data or relationships between the data, a relational database like SQL server is a good idea. If you still don't want to use a database, saving the assets to an xml file is pretty easy if you set up an object hierarchy and then serialize it with the stuff in System.Xml.Serialize. It's very easy. Here's a class that does it in C# and you can translate to VB without any trouble.
c# Syntax (Toggle Plain Text)
  1. using System;
  2. using System.Xml;
  3. using System.Text;
  4. using System.IO;
  5. using System.Xml.Serialization;
  6.  
  7. namespace Hamrick {
  8. /// <summary>
  9. /// Basic utility class for serializing with XML
  10. /// </summary>
  11. public class XmlWrapper {
  12. private XmlWrapper() { }
  13.  
  14. /// <summary> Convert an XML string into a root object </summary>
  15. public static object Deserialize( string xml, Type objType ) {
  16. try {
  17. XmlSerializer xs = new XmlSerializer( objType );
  18.  
  19. using ( StringReader stream = new StringReader( xml ) ) {
  20. return xs.Deserialize( stream );
  21. }
  22. } catch {
  23. return null;
  24. }
  25. }
  26.  
  27. /// <summary> Convert a root object into an XML string </summary>
  28. public static string Serialize( object obj, Type objType ) {
  29. try {
  30. using ( MemoryStream ms = new MemoryStream() ) {
  31. using ( StreamWriter writer = new StreamWriter( ms, Encoding.UTF8 ) ){
  32. XmlSerializer xs = new XmlSerializer( objType );
  33.  
  34. xs.Serialize( writer, obj );
  35.  
  36. return Encoding.UTF8.GetString( ms.ToArray() ).Trim();
  37. }
  38. }
  39. } catch {
  40. return string.Empty;
  41. }
  42. }
  43. }
  44. }
Or you can do just straight file work which is even easier if you have simple data. I like to use the xml approach because it's a great way to take my business objects and serialize them right to a file without any effort.
Reputation Points: 180
Solved Threads: 34
Posting Whiz
Hamrick is offline Offline
322 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: how to start with vb
Next Thread in VB.NET Forum Timeline: Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC