想用C#显示进度条,比如向数据库中写入1000条记录,动态显示写入进度。效果如下:
主要代码如下:
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;
using System.Data.SqlServerCe;
using System.Threading;
namespace ServiceSet
{
public partial class Form1 : Form
{
private int sum = 0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“equipDBDataSet.Equipment”中。您可以根据需要移动或删除它。
this.equipmentTableAdapter.Fill(this.equipDBDataSet.Equipment);
}
private void btnAdd_Click(object sender, EventArgs e)
{
sum =