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
| DataTable tab = new DataTable("Variables");
public Form1()
{
InitializeComponent();
tab.Columns.Add("Nom");
tab.Columns.Add("Variable");
tab.Columns.Add("Description");
tab.Columns.Add("Temps");
dataSet1.Tables.Add(tab);
}
private void buttonAjout_Click(object sender, EventArgs e)
{
Client_OPC.ParamVar confVar = new Client_OPC.ParamVar();
string chaineVar;
string[] temp = new string[3];
DataRow dr = tab.NewRow();
if (!listBoxVar.Items.Contains(textBoxVariable.Text.ToString()) && textBoxVariable.Text.ToString() != "")
{
chaineVar = textBoxVariable.Text.ToString();
confVar.ShowDialog();
temp = confVar.chaineVar;
confVar.Dispose();
// Remplissage d'une ligne
dr["Nom"] = temp[0];
dr["Variable"] = chaineVar;
dr["Description"] = temp[1];
dr["Temps"] = temp[2];
// Enregistrement de la ligne dans la table
tab.Rows.Add(dr);
}
} |