form1.cs

来自「Accessing microsoft live web services fr」· CS 代码 · 共 58 行

CS
58
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using LiveExpoService;


namespace LiveExpoCategoriesDS
{
    public partial class Form1 : Form
    {
        DataView dv;
        DataSet ds;
        int tableIndex = 0;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            ds = LiveExpoCategories.Instance().GetCategoriesDS();
            if (ds != null)
            {
                dv = new DataView(ds.Tables[tableIndex]);
                dataGrid1.DataSource = dv;
            }
            statusBar1.Text = "TableID = " + tableIndex.ToString();
        }

        private void menuItemNext_Click(object sender, EventArgs e)
        {
            tableIndex = (tableIndex + 1) % ds.Tables.Count;
            if (ds != null)
            {
                dv.Dispose();
                dv = new DataView(ds.Tables[tableIndex]);
                dataGrid1.DataSource = dv;
            }
            statusBar1.Text = "TableID = " + tableIndex.ToString();
        }

        private void menuItemExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void Form1_Closing(object sender, CancelEventArgs e)
        {
            ds.Dispose();
            dv.Dispose();
        }
    }
}

⌨️ 快捷键说明

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