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

推荐订阅源

S
Secure Thoughts
P
Privacy International News Feed
T
Tenable Blog
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
S
Securelist
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Cyberwarzone
Cyberwarzone
月光博客
月光博客
T
The Blog of Author Tim Ferriss
Scott Helme
Scott Helme
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
C
Cisco Blogs
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
Security Latest
Security Latest
Blog — PlanetScale
Blog — PlanetScale
G
GRAHAM CLULEY
V
Vulnerabilities – Threatpost
博客园 - 三生石上(FineUI控件)
I
InfoQ
Spread Privacy
Spread Privacy
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
S
SegmentFault 最新的问题
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
C
CERT Recently Published Vulnerability Notes
A
About on SuperTechFans
博客园_首页
Engineering at Meta
Engineering at Meta
Project Zero
Project Zero
Latest news
Latest news

博客园 - 田了你

[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();
  }