The name 'InitializeComponent' does not exist in the current context

codeyell-com 2010-05-13 12:58:29
不知道修改了什么东西后,UI上所有的控件,在代码里都没办法使用。
提示类似:The name 'listBox1' does not exist in the current context

甚至在工程里新加一个窗口的时候,都提示:
The name 'InitializeComponent' does not exist in the current context

请问,这是什么原因?谢谢!!
...全文
631 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
yumenlong5149 2010-05-20
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 lon123 的回复:]
你把InitializeComponent方法删除了。。。
[/Quote]

正解,这个是初始化界面元素的方法,看一下这个必须有
codeyell-com 2010-05-20
  • 打赏
  • 举报
回复
新建工程也出错
重装VISIO也出错
最后
重装了系统
lon123 2010-05-13
  • 打赏
  • 举报
回复
新建一个窗口,在新窗口上还提示错误么?如果没有,就是旧的那个designer文件丢失了
codeyell-com 2010-05-13
  • 打赏
  • 举报
回复
我在工程里新加一个usercontrol,都会报错说找不到InitializeComponent。

[Quote=引用 6 楼 lon123 的回复:]

Listbox那个可能是你删除了Listbox,但是disign文件还没有更新
双击错误,然后转到disign文件的错误点,删掉那一行就可以了
[/Quote]
lon123 2010-05-13
  • 打赏
  • 举报
回复
Listbox那个可能是你删除了Listbox,但是disign文件还没有更新
双击错误,然后转到disign文件的错误点,删掉那一行就可以了
wjp_116 2010-05-13
  • 打赏
  • 举报
回复
InitializeComponent是visual studio编辑器自动生成的代码,你在vs IDE环境中拖放的控件等都是有很多代码来对其进行维护的,其中InitializeComponent就是对这些控件进行初始化的,你可能是把这个方法给弄没了,当然我用vs2003的时候可能是系统的bug吧,有时会在这个方法中突然增加很多别的代码
lon123 2010-05-13
  • 打赏
  • 举报
回复
你把InitializeComponent方法删除了。。。
rqx110 2010-05-13
  • 打赏
  • 举报
回复
你丢失了*.designer.cs文件吧
wuyq11 2010-05-13
  • 打赏
  • 举报
回复
贴出相关代码,检查CS文件
Version 1.7 ----------- - ADD: Delphi/CBuilder 10.2 Tokyo now supported. - ADD: Delphi/CBuilder 10.1 Berlin now supported. - ADD: Delphi/CBuilder 10 Seattle now supported. - ADD: Delphi/CBuilder XE8 now supported. - ADD: Delphi/CBuilder XE7 now supported. - ADD: Delphi/CBuilder XE6 now supported. - ADD: Delphi/CBuilder XE5 now supported. - ADD: Delphi/CBuilder XE4 now supported. - ADD: Delphi/CBuilder XE3 now supported. - ADD: Delphi/CBuilder XE2 now supported. - ADD: Delphi/CBuilder XE now supported. - ADD: Delphi/CBuilder 2010 now supported. - ADD: Delphi/CBuilder 2009 now supported. - ADD: New demo project FlexCADImport. - FIX: The height of the TFlexRegularPolygon object incorrectly changes with its rotation. - FIX: Added division by zero protect in method TFlexControl.MovePathSegment. - FIX: The background beyond docuemnt wasn't filled when TFlexPanel.DocClipping=True. - FIX: In "Windows ClearType" font rendering mode (OS Windows mode) the "garbage" pixels can appear from the right and from the bottom sides of the painted rectangle of the TFlexText object. - FIX: The result rectangle incorrectly calculated in the TFlexText.GetRefreshRect method. - FIX: Added FPaintCache.rcPaint cleanup in the TFlexPanel.WMPaint method. Now it is possible to define is the drawing take place via WMPaint or via the PaintTo direct call (if rcPaint contain non-empty rectangle then WMPaint in progress). - FIX: The TFlexPanel.FPaintCache field moved in the protected class section. Added rcPaint field in FPaintCache that represents drawing rectangle. - ADD: In the text prcise mode (TFlexText.Precise=True) takes into account the rotation angle (TFlexText.Angle). - FIX: Removed FG_NEWTEXTROTATE directive (the TFlexText Precise mode should be used instead). - FIX: The TFlexRegularPolygon object clones incorrectly drawed in case when TFlexRegularPolygon have alternative brush (gradient, texture). - ADD: Add TFlexPanel.InvalidateControl virtual method which calls from TFle
Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver

111,094

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧