المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Hashtable problem in VisualStudio 08 C#



C# Programming
05-01-2009, 05:23 AM
I created a project using .NET Framework 3.0 before I downloaded 3.5...

using C# on Visual Studio 08

Creating a windows program, a basic forms program

I have the following:
using System;
using System.Collections;


namespace Zombie_Zombie_Zombie
{
partial class Form1
{
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
...
private System.Windows.Forms.RichTextBox outputRichText;
private System.Windows.Forms.LinkLabel linkLabel14;

class character
{
protected Hashtable charSheet = new Hashtable();
protected Hashtable calcSheet = new Hashtable();
protected Hashtable mutantStats = new Hashtable();
protected Hashtable mutantPowers = new Hashtable();
// charSheet is the base character sheet with user modifiable values
// calcSheet are the values after calculations... Strength plus Melee plus Sword
// non user modifiable
// mutantStats are the mutant powers that directly affect the base stats, and are added
// into calcSheet
charSheet.Add("Name","")
...
charSheet.Add("Money", "");
}

}
}



Now I'm using this because that's the syntax given here: <a href="http://msdn.microsoft.com/en-us/library/system.collections.hashtable.aspx">MSDN Hashtable Class (System.Collections)

I had originally tried charSheet["Name"] = ""; because I was using Beginning C# Game Programming page 105 on Hashtables.

This is the error code I get:

Error 1 Invalid token '(' in class, struct, or interface member declaration C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Zombie Zombie Zombie\Zombie Zombie Zombie\Form1.Designer.cs 499 26 Zombie Zombie Zombie
...
Error 39 Invalid token '(' in class, struct, or interface member declaration C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Zombie Zombie Zombie\Zombie Zombie Zombie\Form1.Designer.cs 537 26 Zombie Zombie Zombie


help please