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

推荐订阅源

N
News and Events Feed by Topic
WordPress大学
WordPress大学
Vercel News
Vercel News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
小众软件
小众软件
L
LangChain Blog
雷峰网
雷峰网
D
DataBreaches.Net
博客园 - 三生石上(FineUI控件)
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
NISL@THU
NISL@THU
Scott Helme
Scott Helme
量子位
S
Security Affairs
T
Threat Research - Cisco Blogs
博客园_首页
云风的 BLOG
云风的 BLOG
D
Docker
AWS News Blog
AWS News Blog
腾讯CDC
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
U
Unit 42
Recent Announcements
Recent Announcements
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
T
The Exploit Database - CXSecurity.com
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 热门话题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Last Watchdog
The Last Watchdog
C
Cybersecurity and Infrastructure Security Agency CISA
IT之家
IT之家
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
F
Full Disclosure
L
Lohrmann on Cybersecurity
The Hacker News
The Hacker News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Y
Y Combinator Blog
S
Security @ Cisco Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Check Point Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
I
InfoQ

博客园 - 田了你

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