Пример #1
0
        private void Add_New_String_Click(object sender, EventArgs e)
        {
            AddString addString = new AddString();

            addString.ShowDialog();
            if (addString.isOK)
            {
                DataTable dt = (DataTable)dataGridView1.DataSource;
                DataRow   dr;
                dr    = dt.NewRow();
                dr[0] = addString.textID;
                dr[2] = addString.dataGridText;
                dt.Rows.Add(dr);
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = (dataGridView1.Rows.Count).ToString();
            }
            addString.Dispose();
        }
Пример #2
0
        private void Add_New_String_Click(object sender, EventArgs e)
        {
            AddString addString = new AddString();

            addString.ShowDialog();
            if (addString.isOK)
            {
                DataTable dt = (DataTable)dataGridView1.DataSource;
                if (dt == null)
                {
                    //dt = new DataTable();
                    //dt.Columns.Add("Text ID", typeof(String));
                    //dt.Columns.Add("Original", typeof(String));
                    //dt.Columns.Add("Translation", typeof(String));

                    dt = new DataTable();

                    DataColumn dc;
                    dc = new DataColumn(dataGridView1.Columns[0].HeaderText);
                    dt.Columns.Add(dc);
                    dc = new DataColumn(dataGridView1.Columns[1].HeaderText);
                    dt.Columns.Add(dc);
                    dc = new DataColumn(dataGridView1.Columns[2].HeaderText);
                    dt.Columns.Add(dc);

                    dataGridView1.DataSource = dt;

                    dt = (DataTable)dataGridView1.DataSource;
                }
                DataRow dr;
                dr    = dt.NewRow();
                dr[0] = addString.textID;
                dr[2] = addString.dataGridText;
                dt.Rows.Add(dr);
                int cnt = dataGridView1.Rows.Count > 0 ? dataGridView1.Rows.Count - 1 : 0;
                dataGridView1.Rows[cnt].HeaderCell.Value = (dataGridView1.Rows.Count).ToString();
            }
            addString.Dispose();
        }
Пример #3
0
 public StringPicker(AddString addstrInp)
 {
     addstr = addstrInp;
     InitializeComponent();
 }