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

推荐订阅源

AWS News Blog
AWS News Blog
T
Tenable Blog
Project Zero
Project Zero
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
T
Threat Research - Cisco Blogs
T
Threatpost
Security Latest
Security Latest
C
Cisco Blogs
L
Lohrmann on Cybersecurity
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
NISL@THU
NISL@THU
AI
AI
V
Vulnerabilities – Threatpost
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Hacker News: Front Page
U
Unit 42
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MyScale Blog
MyScale Blog
O
OpenAI News
Scott Helme
Scott Helme
V2EX - 技术
V2EX - 技术
P
Proofpoint News Feed
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cyberwarzone
Cyberwarzone
博客园 - 【当耐特】
H
Heimdal Security Blog
S
Schneier on Security
阮一峰的网络日志
阮一峰的网络日志
Help Net Security
Help Net Security
D
DataBreaches.Net
Y
Y Combinator Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
TaoSecurity Blog
TaoSecurity Blog
K
Kaspersky official blog
N
News and Events Feed by Topic
WordPress大学
WordPress大学
P
Palo Alto Networks Blog

博客园 - 田了你

[ZF]开心一下 [转]Java jdbc数据库连接池总结! 一台机器部署N个server步骤 [转]软件开发者面试百问 09年的第一篇日志比已往的时候来得更早一些 - 田了你 - 博客园 [转]关于锚点 - 田了你 - 博客园 从今天开始每天写一篇日志咯 Telerik RadGrid 翻页问题解决 - 田了你 果然是本命年 javascript注册事件的四种方式 - 田了你 - 博客园 Tomcat5.x的项目部署 又被老板欺骗了 2007.2.1 -----2007.4.1安排计划 关于NTKO_office的操作(从数据库中提取数据,写入到NTKO_office_Word中) [转]JS代码格式化工具(附源代码) 层的拖动 获得控件在页面上的绝对位置的方法 解决SQL2000乱码问题 ref与out
.net的优点变缺点(郁闷了一天)
田了你 · 2007-02-09 · via 博客园 - 田了你

.net的优点变缺点(郁闷了一天)

今天在改写‘试题编辑器’时,
发现我在InitializeComponent()方法中写的代码消失了
(我在InitializeComponent中进行了PanelEdit = new PanelClass)
而我的PanelClass为自定义的panel.
编译的时候出现了PanelEdit 未对象事例的错误。
一看InitializeComponent中自己写的代码已经消失了
尴尬的花了一个小时才找到原因:.net自作聪明的根据form元素帮你重新生成代码,把我写的代码删除掉了。
解决方案:(1)适合于:(webForm)。定义为一个方法,在OnInit里进行调用
              (2 )适合于(WinForm):定义为一个方法,构造函数里进行调用。且在InitializeComponent()方法前进行调用。
eg:
  private void getPanleEidt()
  {
   this.PanelEdit = new WordInDOTNET.PanelClass();
   // PanelEdit
   this.PanelEdit.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    | System.Windows.Forms.AnchorStyles.Right)));
   this.PanelEdit.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
   this.PanelEdit.diffNumber = 0;
   this.PanelEdit.Disp = null;
   this.PanelEdit.Location = new System.Drawing.Point(136, 80);
   this.PanelEdit.Name = "PanelEdit";
   this.PanelEdit.Size = new System.Drawing.Size(712, 240);
   this.PanelEdit.TabIndex = 26;
   this.PanelEdit.testType = null;
   this.Controls.Add(this.PanelEdit);
  }
//构造函数
  public frmMain()
  {
   //
   // Required for Windows Form Designer support
   //
   //初始PanleEidt
   this.getPanleEidt();
   InitializeComponent();
  }