惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - semye

input+select(multiple)实现下拉框输入值 - semye 简单的js分页脚本 - semye - 博客园 请问做个类似这样的网站多少钱 省份和城市 - semye 客户端取用户控件中服务器控件的标识 VS2003调试很慢 - semye enctype="multipart/form-data" 群发邮件太慢了! - semye SQL SERVER “数组参数” WEB水晶报表部署笔记 写程序解智力题,help!!! 低级错误是怎样“炼”成的? - semye SQL语句区分大小写问题 发送邮件 - semye - 博客园 JS事件大全 WinForm动态添加控件及其事件 WinForm程序实现滚动字幕与背景音乐 公历转换为农历 简单水晶报表程序与安装部署文件制作 - semye
导数程序
semye · 2007-03-16 · via 博客园 - semye

winform程序,用来实现导数,并显示进度与执行情况,界面如下:

页面级代码如下:

        /// <summary>
        
/// 应用程序的主入口点。
        
/// </summary>

        [STAThread]
        
static void Main() 
        
{
            Application.Run(
new Form1());
        }

        
delegate void ExcuteDelegate();
        
private void button1_Click(object sender, System.EventArgs e)
        
{
            ExcuteDelegate dlg 
= new ExcuteDelegate(this.DoLeadData);
            dlg.BeginInvoke(
null,null);
        }

        
/// <summary>
        
/// 导入数据
        
/// </summary>
        
/// <returns></returns>

        public void DoLeadData()
        
{
            
            Bll.LeadData bl 
= new Bll.LeadData();
            DataSet dsMain 
= new DataSet();
            int i=0;
            ArrayList alClass 
= new ArrayList();
            Model.Status mdst 
= new Model.Status();
            
//取主表RouteMainInfo数据
            dsMain = bl.GetMainData();
            
//取记录总数
            int count = dsMain.Tables[0].Rows.Count;
            bl.ChangStatus(mdst,
"",count);
            
//    ChangStatus(mdst,"",count);
            if(count>0)
            
{
                
for(i=6;i<100;i++)
                
{
                    bl.DoLead(i,mdst,dsMain);
                    
this.ViewDoing();
                }

            }

        }
    
        
private  void   ViewDoing()
        
{
            Model.Status md 
= new Model.Status();
            
this.label2.Text = md.total.ToString();
            
this.label4.Text = md.finish.ToString();
            
this.label6.Text = md.success.ToString();
            
this.label8.Text = md.fail.ToString();
            
this.progressBar1.Maximum=md.total;
            
this.progressBar1.Minimum=0;
            
this.progressBar1.Value = md.finish;
        }

其中 BLL层的方法DoLead(……)是实现导数的核心方法,方法ViewDoing()用来在界面显示当前执行状态,原来方法DoLeadData()是放在BLL层中,方法ViewDoing()在页面级,问题是这样达不到界面同步显示程序执行进度的效果,所有才把
for(i=6;i<100;i++)
             
{
                    bl.DoLead(i,mdst,dsMain);
                    
this.ViewDoing();
                }
以外的代码提到页面级来,把 this.ViewDoing()放到循环体进去,才达到我要结果,我想问一下,如何让这个FOR循环在BLL层执行,而又能实现我要的效果?
请高手指点!