Gijs
Gijs
CC#
Created by Gijs on 10/3/2023 in #help
❔ winforms storage system (beginner)
I'm new to winforms and for school I have to make a storage system. I'm completly done the only thing that doesn't work is the selling of shoes, I have no idea how to implement this. I use a datagridview to show the storage, the person selling has a textbox and a button where they can first put the number in the textbox and then click the button to remove x amount of shoes this is my code:
Public mwVoorraad()
{

InitializeComponent();
FillDataGrid();

}
public void FillDataGrid()
{
dt.Rows.Clear();
dt.Columns.Clear();
dt.Columns.Add("Merk");
dt.Columns.Add("Type");
dt.Columns.Add("Maat");
dt.Columns.Add("Kleur");
dt.Columns.Add("Prijs");
dt.Columns.Add("Aantal");

foreach (string[] schoen in voorraad.schoenenvoorraad)
{
dt.Rows.Add(schoen);
}
dgvAdmin.DataSource = dt;
}

private void btVerkoop_Click(object sender, EventArgs e)
{

}

private void btBackToMenu_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Public mwVoorraad()
{

InitializeComponent();
FillDataGrid();

}
public void FillDataGrid()
{
dt.Rows.Clear();
dt.Columns.Clear();
dt.Columns.Add("Merk");
dt.Columns.Add("Type");
dt.Columns.Add("Maat");
dt.Columns.Add("Kleur");
dt.Columns.Add("Prijs");
dt.Columns.Add("Aantal");

foreach (string[] schoen in voorraad.schoenenvoorraad)
{
dt.Rows.Add(schoen);
}
dgvAdmin.DataSource = dt;
}

private void btVerkoop_Click(object sender, EventArgs e)
{

}

private void btBackToMenu_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
if there is anything else you spot wrong with the code please let me know!
145 replies
CC#
Created by Gijs on 9/13/2023 in #help
✅ C# webforms counting problem
Hey I'm new to c# I have been working with c# for 3 days now but I stummbeld on a problem I can't get fixed
public int counter = 3;

MessageBox.Show("You have" + counter - 1 + "Tries left");
public int counter = 3;

MessageBox.Show("You have" + counter - 1 + "Tries left");
once I do this I get the error: Operator '-' cannot be applied to operands of type 'string' and 'int'. And I have no idea how to fix it. It's probarlly something really simple but I just can't seem to get it
6 replies