Example #1
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            using (EditBar editBar = new EditBar())
            {
                editBar.Text = Resource1.LabelValueNewBar;
                if (editBar.ShowDialog() == DialogResult.OK)
                {
                    DataRow row = ((DataRowView)this.barsBindingSource.Current).Row;
                    row[Resource1.BarTableName]        = editBar.BarName;
                    row[Resource1.BarTableAddress]     = editBar.BarAddress;
                    row[Resource1.BarTableCoordinates] = editBar.BarCoordinates != string.Empty ? editBar.BarCoordinates : null;
                    row[Resource1.BarTableAverage]     = 0.00;
                    row[Resource1.BarTableCount]       = 0;

                    this.barsBindingSource.EndEdit();
                    this.barsTableAdapter.Update(this.hollyWaterDbDataSet.Bars);
                }
                else
                {
                    barsBindingSource.CancelEdit();
                }
            }
        }
Example #2
0
        private void editRow()
        {
            using (EditBar editBar = new EditBar())
            {
                editBar.Text = Resource1.LabelValueNewBar;
                DataRow row = ((DataRowView)this.barsBindingSource.Current).Row;
                editBar.BarName        = row[Resource1.BarTableName].ToString();
                editBar.BarAddress     = row[Resource1.BarTableAddress].ToString();
                editBar.BarCoordinates = row[Resource1.BarTableCoordinates].ToString();


                if (editBar.ShowDialog() == DialogResult.OK)
                {
                    row[Resource1.BarTableName]        = editBar.BarName;
                    row[Resource1.BarTableAddress]     = editBar.BarAddress;
                    row[Resource1.BarTableCoordinates] = editBar.BarCoordinates != string.Empty ? editBar.BarCoordinates : null;
                    row[Resource1.BarTableAverage]     = 0.00;


                    this.barsBindingSource.EndEdit();
                    this.barsTableAdapter.Update(this.hollyWaterDbDataSet.Bars);
                }
            }
        }