Windows窗体中的文本框不会在VSTO中更新,但在VBA中它运行得非常好 [英] Textbox in the windows form not updating in VSTO but in VBA it runs very well

查看:115
本文介绍了Windows窗体中的文本框不会在VSTO中更新,但在VBA中它运行得非常好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为MSProject添加一个插件查找是否将前任分配给每个任务。


我在循环中使用一个对象来运行项目中的所有任务&循环如下,以查找未分配前任的任务数。


For each tsk in projApp.ActiveProject.Tasks          


        如果Not tsk Is Nothing那么   '测试空白行               


              如果不是tsk.Summary那么       '如果不是摘要
任务                   


                    如果tsk.Predecessors =""然后
                      &NBSP ;


                            
NOPRED = NOPRED + 1                  


                   结束如果              


              结束如果        


       结束如果       


Next tsk


NoPred中的数据以窗口形式传输到文本框。


当您第一次运行代码时,表单中的文本框显示没有前辈的任务数量正确。假设有5个任务没有
的前辈,表格清楚地显示了5.但是假设我将前任分配给某些任务&当我运行代码时它再次显示5。但是,如果我关闭VSTO&重新运行,然后显示正确。


但是在项目VBA中,这样可以正常工作。


任何人都可以在这个问题上给我启发。


提前致谢。


Rameshchandra C Keni(PMP)


 


|


 




RCKeni

解决方案

< blockquote>

Hello Rameshchandra,


>但是,如果我关闭VSTO并重新运行,那么它会正确显示。


你到底关闭了什么?表格?你可以更具体一点吗?


I am trying an addin for MSProject to find if the predecessors are assigned to every task.

I am using an object in the loop to run for all the tasks in the project & the loop is as under to find how many tasks are not assigned the predecessors.

For Each tsk In projApp.ActiveProject.Tasks           

         If Not tsk Is Nothing Then   'Test for blank row                

               If Not tsk.Summary Then       'If not a Summary Task                    

                     If tsk.Predecessors = "" Then                        

                            NoPred = NoPred + 1                   

                    End If               

               End If         

        End If        

Next tsk

The data in NoPred is transferred to the Textbox in the window form.

When you run the code for the 1st time the textbox in the form shows the number of Tasks not having predecessors correctly. Suppose there are 5 tasks without predecessors, the form clearly shows 5. But suppose I assign the predecessors to some of the tasks & when I run the code it again shows 5 only. however if I close the VSTO & rerun then it shows correctly.

However in project VBA this works fine.

Can anybody enlighten me on the issue.

Thanks in Advance.

Rameshchandra C Keni (PMP)

 

|

 


RCKeni

解决方案

Hello Rameshchandra,

> however if I close the VSTO & rerun then it shows correctly.

What exactly do you close? The form? Could you please be more specific?


这篇关于Windows窗体中的文本框不会在VSTO中更新,但在VBA中它运行得非常好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆