Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
public partial class MyGirdVieuw : DataGridView
{
public MyGirdVieuw()
{
InitializeComponent();
}
public void prijstot() {
try
{
this.Enabled = false;
this.Enabled = true;
if(int.Parse(this.Rows[this.CurrentCell.RowIndex].Cells[2].Value.ToString()) < 1 )
this.Rows[this.CurrentCell.RowIndex].Cells[2].Value = 1;
this.Rows[this.CurrentCell.RowIndex].Cells[4].Value = int.Parse(this.Rows[this.CurrentCell.RowIndex].Cells[2].Value.ToString()) * double.Parse(this.Rows[this.CurrentCell.RowIndex].Cells[3].Value.ToString());
}
catch (Exception)
{
this.Rows[this.CurrentCell.RowIndex].Cells[2].Value = 1;
this.Rows[this.CurrentCell.RowIndex].Cells[4].Value = 0;
}
}
public bool volgendelijn() {
try
{
this.Rows[this.CurrentCell.RowIndex + 1].ReadOnly = false;
this.CurrentCell = this.Rows[this.CurrentCell.RowIndex + 1].Cells[0];
this.BeginEdit(true);
return true;
}
catch (ArgumentOutOfRangeException)
{
return true;
}
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Enter)
{
if (this.CurrentCell == this.Rows[this.CurrentCell.RowIndex].Cells[0]){
int row = this.CurrentCell.RowIndex;
this.Enabled = false;
this.Enabled = true;
ArtikelInput ai = new ArtikelInput();
ai.Show();
ai.FormClosing += delegate
{
if (ai.getArtikel() != null) {
this.Rows[this.CurrentCell.RowIndex].Cells[0].Value = ai.getArtikel().ArtikelNr;
this.Rows[this.CurrentCell.RowIndex].Cells[1].Value = ai.getArtikel().Omschrijving;
this.Rows[this.CurrentCell.RowIndex].Cells[3].Value = ai.getArtikel().Prijs;
this.CurrentCell = this.Rows[this.CurrentCell.RowIndex].Cells[2];
this.BeginEdit(true);
this.CellValueChanged += delegate {
// if(this.CurrentCell == this.Rows[this.CurrentCell.RowIndex].Cells[2])
prijstot();
};
}
};
return true;
}
else if (this.CurrentCell == this.Rows[this.CurrentCell.RowIndex].Cells[2])
{
prijstot();
return volgendelijn();
}
else
{
if (this.CurrentCell.ColumnIndex < ColumnCount - 1)
{
this.CurrentCell = this.Rows[this.CurrentCell.RowIndex].Cells[this.CurrentCell.ColumnIndex + 1];
return true;
}
else
{
return volgendelijn();
}
}
}
return base.ProcessCmdKey(ref msg, keyData);
}
}
public partial class Facturen : Form
{
public Facturen()
{
InitializeComponent();
}
private void Facturen_Load(object sender, EventArgs e)
{
string[] row = new string[] { "", "" };
dataGridView1.Rows.Add(row);
for (int i = 1; i < 13; i++)
{
dataGridView1.Rows.Add(row);
dataGridView1.Rows[i].ReadOnly = true;
}
}
private void btnRemoveRow_Click(object sender, EventArgs e)
{
try
{
int current = this.dataGridView1.CurrentRow.Index;
dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex + 1].ReadOnly = false;
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex + 1].Cells[0];
dataGridView1.BeginEdit(true);
dataGridView1.Rows.RemoveAt(current);
if (dataGridView1.RowCount < 13) {
string[] row = new string[] { "", "" };
dataGridView1.Rows.Add(row);
dataGridView1.Rows[12].ReadOnly = true;
}
}
catch (Exception)
{
}
Double totaal = 0.0;
this.Enabled = false;
this.Enabled = true;
for (int i = 0; i < dataGridView1.RowCount; i++)
{
try
{
totaal += Double.Parse(dataGridView1.Rows[i].Cells[4].Value.ToString());
}
catch (Exception)
{
}
txtTotaal.Text = totaal + " €";
}
}
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
Double totaal = 0.0;
if (e.ColumnIndex == 4) {
this.Enabled = false;
this.Enabled = true;
for (int i = 0; i < dataGridView1.RowCount; i++)
{
try
{
totaal += Double.Parse(dataGridView1.Rows[i].Cells[4].Value.ToString());
}
catch (Exception)
{
}
}
txtTotaal.Text = totaal + " €";
}
}
}
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.