⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productcategoryeditviewdialog.cs

📁 清华大学出版社出版的 移动应用开发宝典 张大威(2008)的附书源代码
💻 CS
字号:
using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace MobileDevelopersHandbook
{
    public partial class ProductCategoryEditViewDialog : Form
    {
        private static ProductCategoryEditViewDialog defaultInstance;

        public static ProductCategoryEditViewDialog Instance(System.Windows.Forms.BindingSource bindingSource)
        {
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
            if ((defaultInstance == null))
            {
                defaultInstance = new MobileDevelopersHandbook.ProductCategoryEditViewDialog();
                defaultInstance.productCategoryResultSetBindingSource.DataSource = bindingSource;
            }
            defaultInstance.productCategoryResultSetBindingSource.Position = bindingSource.Position;
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            return defaultInstance;
        }

        public ProductCategoryEditViewDialog()
        {
            InitializeComponent();
        }

        private void cancelMenuItem_Click(object sender, EventArgs e)
        {
            this.productCategoryResultSetBindingSource.CancelEdit();
            this.DialogResult = DialogResult.Cancel;
        }

        private const int SSCE_M_NULLINVALID = 25005;

        private void saveMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                this.productCategoryResultSetBindingSource.EndEdit();
                // Close the form
                this.DialogResult = DialogResult.OK;
            }
            // If your underlying DataSource is a SqlCeResultSet, then EndEdit causes
            // changes to applied to the database, hence you will get a SqlCeException
            // if a constraint is violated, or some other error.
            // If your data source is a DataTable, you will get an exception from System.Data
            catch (System.Data.SqlServerCe.SqlCeException sqlEx)
            {
                if (sqlEx.NativeError == SSCE_M_NULLINVALID)
                {
                    MessageBox.Show("You must specify a name");
                }
                else
                    throw;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -