Hi, I am working on some examples of my own and now looking to include a new class for my Banking transactions. Seems like I am doing something in the wrong place etc. I typed in the new code ahead of the standard code created by Visual Studio (17) (I didn't add an item). The information I wanted to create appears in the right hand window CLASS VIEW but I get the errors.
using System.Windows.Forms;
public class transactiondata
{
public DateTime transDT;
public string transtext;
public double transRECD;
public double transPAID;
public string transFlag;
}
//parameterised Constructor
public transactiondata(DateTime transDT, string transtext, double transRECD, double transPAID, string transFlag)
{
this.transDT = transDT;
this.transtext = transtext;
this.transRECD = transRECD;
this.transPAID = transPAID;
this.transFlag = transFlag;
return;
}
namespace Santander01
{
public partial class Form1 : Form
{
public Form1()
CLASS VIEW shows the class and items above THE ERROR 1>------ Build started: Project: Santander01, Configuration: Debug Any CPU ------ 1>C:\Users\HOME\Documents\Visual Studio 2017\Projects\Santander01\Santander01\Form1.cs(19,8,19,23): error CS0116: A namespace cannot directly contain members such as fields or methods 1>C:\Users\HOME\Documents\Visual Studio 2017\Projects\Santander01\Santander01\For Any help appreciated