C#可视化编程技术总结:制作可视化窗体软件

笔记:
详情已经在前面的章节有列述了,这里只点出几个比较重要的:
string name = DataGridView对象.SelectedRows[0].Cells[0].Value.ToString();获取在DataGridView控件中选中的一行的第cells[0]列数据。

窗体样式:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
代码如下:

主窗体,“手机销售管理系统”代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace product6._10
{
    public partial class FrmSalesManage : Form
    {
        public FrmSalesManage()
        {
            InitializeComponent();
        }
   
    private void 客户添加ToolStripMenuItem_Click(object sender, EventArgs e)
    {
        //客户添加
        FrmAddClient frmAdd = new FrmAddClient();
        frmAdd.MdiParent = this;
        frmAdd.Show();
    }

    private void 客户查询ToolStripMenuItem_Click(object sender, EventArgs e)
    {
        //查询客户
        FrmSelectClient frmSelect = new FrmSelectClient();
        frmSelect.MdiParent = this;
        frmSelect.Show();
    }

    private void 客户查询ToolStripMenuItem1_Click(object sender, EventArgs e)
    {
        //查询客户
        FrmSelectClient frmSelect = new FrmSelectClient();
        frmSelect.MdiParent = this;
        frmSelect.Show();
    }

    private void 客户添加ToolStripMenuItem1_Click(object sender, EventArgs e)
    {
        //客户添加
        FrmAddClient frmAdd = new FrmAddClient();
        frmAdd.MdiParent = this;
        frmAdd.Show();
    }

    //退出所有程序
    private void FrmSalesManage_FormClosing(object sender, FormClosingEventArgs e)
    {
        Application.Exit();
    }

    private void 安全退出ToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }

    private void 安全退出ToolStripMenuItem1_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }
}
}

在这里插入图片描述
查询窗体:“客户查询”代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace product6._10
{
    public partial class FrmSelectClient : Form
    {
        public FrmSelectClient()
        {
            InitializeComponent();
        }
    
    //刷新列表
    public void RefreshList()
    {
        string sql = "select * from Customer";
        DataTable table = DBHelper.GetDataTable(sql);
        ClientInformation.DataSource = table;
        
    }
    
    //初始换程序选项
    private void FrmSelectClient_Load(object sender, EventArgs e)
    {
        RefreshList();

        cbType.Items.Clear();
        cbType.Items.A
  • 14
    点赞
  • 46
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值