コード例 #1
0
        protected virtual void Add()
        {
            if (_EntityForm == null)
            {
                if (EntityNew != null)
                {
                    EntityNew(this, new ValueEventArgs(null));
                }
            }
            else
            {
                try
                {
                    if (_EntityForm.ShowDialog() == DialogResult.OK)
                    {
                        ((BindingList <TD>)Grid.DataSource).Add((TD)_EntityForm.Value);

                        //TD[] ds = Grid.DataSource as TD[];
                        //ds = Common.ReDim<TD>(ds);
                        //ds[ds.Length - 1] = (TD)_EntityForm.Value;
                        //Grid.DataSource = ds;
                    }
                }
                catch (Exception Ex)
                {
                    MessageBox.Show(Common.ExMessage(Ex), "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #2
0
        public void FireLinkClicked()
        {
            if (LinkClicked != null)
            {
                LinkClicked(this, EventArgs.Empty);
            }
            OKCancelForm frm = CreateForm();

            if (frm != null && frm.ShowDialog(this) == DialogResult.OK)
            {
                this.Value = frm.Value;
            }
        }