I am having issues on how to assign stock names and respective price on the board positions in a monopoly game in C#, SO far i have only few lines of codes, I need some assistance.

stockname.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    class stock
    {

        public string stockname;
        public string stockprice;
        public string stockposition;



    }



}


for my windows form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {


            stock newstock = new stock();
            newstock.stockname = "ATT";
            newstock.stockprice = "20";
            newstock.stockposition= "1";

        }

        }
        }

Recommended Answers

All 2 Replies

Hi,

OK so you have a class set up for your stock and you are using it correctly, from the looks of what you have given. How will you show the user the board?

Use a List List<stock> Mystocks = new List<stock>();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.