productform.cs
来自「微软(Microsoft)出版社C井练习文件及解答」· CS 代码 · 共 43 行
CS
43 行
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ProductInfo.NorthwindServices;
namespace ProductInfo
{
public partial class ProductForm : Form
{
public ProductForm()
{
InitializeComponent();
}
private void getProduct_Click(object sender, EventArgs e)
{
Service northwindService = new Service();
try
{
Product prod = northwindService.GetProductInfo(productName.Text);
productID.Text = prod.ProductID.ToString();
supplierID.Text = prod.SupplierID.ToString();
categoryID.Text = prod.CategoryID.ToString();
quantityPerUnit.Text = prod.QuantityPerUnit;
unitPrice.Text = prod.UnitPrice.ToString();
unitsInStock.Text = prod.UnitsInStock.ToString();
unitsOnOrder.Text = prod.UnitsOnOrder.ToString();
reorderLevel.Text = prod.ReorderLevel.ToString();
discontinued.Checked = prod.Discontinued;
}
catch (Exception ex)
{
MessageBox.Show("Error fetching product details: " +
ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?