在datagridview中加载数据时如何使用进度条/微调器? [英] How to use progress bar/spinner when data is loading in datagridview?
本文介绍了在datagridview中加载数据时如何使用进度条/微调器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我正在制作一个Windows应用程序
当我点击Button时,数据正在Datagridview中加载,
在这一步中,我想使用进度条或微调器显示进度。
但对我来说,这是第一次使用它,我不知道......
我只是搜索它并使用背景工作者或线程...
请有人帮助我。
我的按钮点击事件如下。如何添加或修改代码?
我尝试过:
Hello, I`m making a windows application
When I click the Button then data is loading in Datagridview,
In this step I want to show the progress using Progress bar or spinner.
But for me, this is the first time to use that, I don`t have no idea...
I just searched it and use backgroundworker or thread...
Please somebody help me.
My button click event is below. how can I add or modify code?
What I have tried:
private void btnStart_Click(object sender, EventArgs e)
{
string webApplicationName = string.Empty;
string siteID = string.Empty;
mtlblError.Text = "no record returned";
Migration_Status_DAC dac = new Migration_Status_DAC();
DataSet ds = new DataSet();
try
{
ds = dac.SelectWebApplicationStatus(mtextUrl.Text);
DataTable dt = ds.Tables[0];
if (ds != null && dt != null && dt.Rows.Count > 0)
{
webApplicationName = dt.Rows[0]["AppName"].ToString();
mgrdWebApplication.DataSource = dt;
}
else
{
mtlblError.Visible = true;
}
}
catch(Exception ex)
{
LogWrite.writeLog(ex.ToString();
}
}
推荐答案
你的答案在这里 - c# - 使用DataTable将数据加载到DataGridView的进度条 - 堆栈溢出 [ ^ ]。
Your answer here - c# - Progressbar for loading data to DataGridView using DataTable - Stack Overflow[^].
这篇关于在datagridview中加载数据时如何使用进度条/微调器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文