今天看CAB的时候才发现有个DesignMode属性,以前不知道它,所以设计时总要执行一些诸如连接数据库等的初始化代码,很是影响速度。以后都要在OnLoad中加上IF DesignMode = False 的判断了。
下面就是CustomerListView中的OnLoad的代码:

Protected Overrides Sub OnLoad()Sub OnLoad(ByVal e As EventArgs)
If DesignMode = False Then
innerController.PopulateCustomersData()
customerListBox.DataSource = innerCustomer
customerListBox.DisplayMember = "FullName"
AddHandler customerListBox.SelectedIndexChanged, AddressOf customerListBox_SelectedIndexChanged
End If
End Sub
1081



被折叠的 条评论
为什么被折叠?



