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.

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)....

Hey if i didnt want to use a database to store the data, would i need to use an array of some sort?

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.

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.

using System;
using System.Xml;
using System.Text;
using System.IO;
using System.Xml.Serialization;

namespace Hamrick {
  /// <summary>
  /// Basic utility class for serializing with XML
  /// </summary>
  public class XmlWrapper {
    private XmlWrapper() { }

    /// <summary> Convert an XML string into a root object </summary>
    public static object Deserialize( string xml, Type objType ) {
      try {
        XmlSerializer xs = new XmlSerializer( objType );

        using ( StringReader stream = new StringReader( xml ) ) {
          return xs.Deserialize( stream );
        }
      } catch {
        return null;
      }
    }

    /// <summary> Convert a root object into an XML string </summary>
    public static string Serialize( object obj, Type objType ) {
      try {
        using ( MemoryStream ms = new MemoryStream() ) {
          using ( StreamWriter writer = new StreamWriter( ms, Encoding.UTF8 ) ){
            XmlSerializer xs = new XmlSerializer( objType );

            xs.Serialize( writer, obj );

            return Encoding.UTF8.GetString( ms.ToArray() ).Trim();
          }
        }
      } catch {
        return string.Empty;
      }
    }
  }
}

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. :)

This article has been dead for over six months. Start a new discussion instead.