1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
namespace WinAddNewItem
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
DataTable tableArticle = GetArticle();
DGV_Article_P2.DataSource = tableArticle;
}
private DataTable GetArticle()
{
DataTable table = new DataTable();
table.Columns.Add("ID_Auto", typeof(string));
table.Columns.Add("Nom", typeof(string));
table.Columns.Add("Num_Ref", typeof(string));
table.Columns.Add("Designations", typeof(string));
DataRow dr = table.NewRow();
Random rnd = new Random();
for (int i = 1; i < 21; i++)
{
dr[0] = i.ToString();
dr[1] = "Article" + i.ToString();
dr[2]= rnd.Next(200,500).ToString();
dr[3] = "Valise";
table.Rows.Add(dr);
dr=table.NewRow();
}
return table;
}
private DataTable GetDmd()
{
DataTable table = new DataTable();
table.Columns.Add("ID_Auto", typeof(string));
table.Columns.Add("Reference", typeof(string));
table.Columns.Add("Quittance", typeof(string));
table.Columns.Add("Designations", typeof(string));
table.Columns.Add("Montant HT", typeof(string));
return table;
}
DataTable tableDmd = null;
private void DGV_Article_P2_RowEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
if (e.RowIndex == 0)
{
tableDmd = GetDmd();
DGV_New_Dmd.DataSource = tableDmd;
}
DataGridViewRow Row1 = DGV_Article_P2.Rows[e.RowIndex];
if (Row1 != null)
if (Txt_Valide_Article.Text.ToUpper() == "OUI")
{
tableDmd.Rows.Add("", Row1.Cells["Num_Ref"].Value.ToString(), "", Row1.Cells["Designations"].Value.ToString(), "");
}
}
}
private void Txt_Valide_Article_Validated(object sender, EventArgs e)
{
}
}
} |
Partager