vb.net “没有可用于 ../Form1.vb 的编辑器”错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4911099/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"There is no editor available for ../Form1.vb" error?
提问by Voldemort
I was happily using VB.NET, saved, and, well, there was a blackout.
我很高兴地使用 VB.NET,保存了下来,而且,停电了。
Probably lucky? Well, now I open my project just fine, double click the Form1.vb and.... "There is no editor available for ../Form1.vb, make sure the application for the file type (.vb) is installed."
大概是幸运?好吧,现在我打开我的项目就好了,双击 Form1.vb 和....“没有可用于 ../Form1.vb 的编辑器,请确保安装了文件类型 (.vb) 的应用程序。 ”
.......... Did something go wrong with my project? Is it dead?
..... 我的项目有问题吗?它死了吗?
Windows 7, Visual Basic 2010 Express.
Windows 7、Visual Basic 2010 Express。
What should I do?
我该怎么办?
采纳答案by Cody Gray
It's difficult to imagine what you're seeing. I've seen plenty of cases where the design view won't open for whatever reason, but I've never been unable to view the codefor the form.
很难想象你所看到的。我见过很多设计视图因某种原因无法打开的情况,但我从未无法查看表单的代码。
First thing to try is navigating to your project folder in Windows Explorer, right-clicking on the Form1.vb
file, and trying to open it in Notepad. This is pretty much the ultimate test. If you can open it in Notepad, your work is salvageable. If not, the file is corrupted and your best bet is to start over.I suppose if you reallyfeel that you have a lot invested, you could try various file recovery techniques, but considering it's a single form file, I seriously doubt it's worth the time or expense.
首先要尝试的是在 Windows 资源管理器中导航到您的项目文件夹,右键单击该Form1.vb
文件,然后尝试在记事本中打开它。这几乎是终极考验。如果您可以在记事本中打开它,则您的工作是可以挽救的。如果没有,则文件已损坏,最好的办法是重新开始。我想如果你真的觉得你投入了很多,你可以尝试各种文件恢复技术,但考虑到它是一个单一的表单文件,我严重怀疑它是否值得花时间或费用。
If that succeeds, and you canopen the file in Notepad, select all the code and copy it to the clipboard. Now go back into Visual Studio, and add a new Form
to your project. Delete everything in the new form's code file and paste the salvaged code from your original form back in. You still won't be able to open the form in the designer though, and you'll likely be missing references to all of your controls. Ignore all those squiggly underlines for now.
如果成功,您可以在记事本中打开文件,选择所有代码并将其复制到剪贴板。现在返回到 Visual Studio,Form
并向您的项目添加一个新项目。删除新表单代码文件中的所有内容,然后将原始表单中的抢救代码粘贴回。但您仍然无法在设计器中打开该表单,并且您可能会丢失对所有控件的引用。暂时忽略所有那些弯弯曲曲的下划线。
To fix that, you need to go back to Windows Explorer, and find a file named Form1.Designer.vb
. This is the partial class that the designer saves information into; it contains declarations for all of your controls and the properties you set for those controls at design time. Just as before, right-click on this file and open it in Notepad. Select everything and copy it to the clipboard. Now go back to Visual Studio, and click on the "Show All Files" button at the top of the Solution Explorer (hover over them to read the ToolTips). You'll see a bunch of extra junk show up, but what you're primarily interested in are the drop-down arrows that just appeared to the side of every Form
class. Expand the new form you added in the previous step, and find it's .Designer
file. Delete everything that's in there now, and paste in the code from your salvaged form's .Designer
file.
要解决这个问题,您需要返回 Windows 资源管理器,并找到一个名为Form1.Designer.vb
. 这是设计者保存信息的部分类;它包含所有控件的声明以及您在设计时为这些控件设置的属性。和以前一样,右键单击此文件并在记事本中打开它。选择所有内容并将其复制到剪贴板。现在返回到 Visual Studio,然后单击解决方案资源管理器顶部的“显示所有文件”按钮(将鼠标悬停在它们上以阅读工具提示)。您会看到一堆额外的垃圾出现,但您主要感兴趣的是刚刚出现在每个Form
类旁边的下拉箭头。展开您在上一步中添加的新表单,并找到它.Designer
文件。删除现在那里的所有内容,然后粘贴从回收表单.Designer
文件中的代码。
You now have an exactcopy of your old form in your project. You can delete that old, corrupted form file, because you're no longer using it. You'll also probably want to change the name of the new file itself by right-clicking on it in the Solution Explorer—right now, it's named Form1
just like your old form, because it's an exact copy of that form. The code says it's name is Form1
and couldn't care less about your file name. Clean and rebuild your project, and if things go your way, everything should be back to normal.
您现在在项目中拥有旧表单的精确副本。您可以删除旧的、损坏的表单文件,因为您不再使用它。您可能还想通过在解决方案资源管理器中右键单击新文件本身来更改它的名称——现在,它的命名Form1
就像您的旧表单一样,因为它是该表单的精确副本。代码说它的名字是Form1
并且不在乎你的文件名。清理并重建您的项目,如果一切顺利,一切都应该恢复正常。
回答by Alex
The same thing just occurred to me but I couldn't get it fixed trying the previous answers. For some reason, one of my references Microsoft.Office.Core
had a yellow exclamation point on it.
同样的事情刚刚发生在我身上,但我无法通过尝试以前的答案来解决它。出于某种原因,我的一个参考文献上Microsoft.Office.Core
有一个黄色的感叹号。
Simple Solution
简单的解决方案
- Solution Explorer
- Expand References
- Right click on the item with "Yellow Triangle w/ "!" point"
- Select "Remove"
- Open the "Build" Menu at the top
- Select Rebuild "filename"
- 解决方案资源管理器
- 展开参考
- 右键单击带有“带“!”点的“黄色三角形”的项目
- 选择“删除”
- 打开顶部的“构建”菜单
- 选择重建“文件名”
Once this was done, I could open my forms correctly.
完成此操作后,我可以正确打开表单。
回答by Kyle Pantall
Windows 7/ Vista: Try right clicking the .vb file and selecting the "Previous versions" tab. When the list has loaded (if it has) select the most recent file from the list and select "Restore". Now reload your project, try doing this with all of the form files, e.g. "Form1.resx" and "Form1.designer.vb" and "Form1.vb" and then reload the project.
Windows 7/ Vista:尝试右键单击 .vb 文件并选择“以前的版本”选项卡。加载列表后(如果已加载)从列表中选择最新的文件并选择“恢复”。现在重新加载您的项目,尝试使用所有表单文件执行此操作,例如“Form1.resx”和“Form1.designer.vb”和“Form1.vb”,然后重新加载项目。
回答by Shyam
It implies that the file is corrupted.Replace an uncorrupted copy of that file in the corresponding directory and then try.
这意味着文件已损坏。请在相应目录中替换该文件的未损坏副本,然后尝试。
回答by user1486361
I had the same problem and it was from a bad reference to Excel caused by copying the project from a Win7 machine to a Win8 machine probably.
我遇到了同样的问题,可能是由于将项目从 Win7 机器复制到 Win8 机器而导致对 Excel 的错误引用。
Open the solution explorer and expand the references You will see two references with the yellow exclamation mark icon beside them indicating a problem - Microsoft.Office.Core - Microsoft.Office.Interop.Excel Right click on both these icons and click remove Your form should load now, if not, save the project, close it then reopen it.
打开解决方案资源管理器并展开引用您将看到两个引用,旁边带有黄色感叹号图标,表示存在问题 - Microsoft.Office.Core - Microsoft.Office.Interop.Excel 右键单击这两个图标,然后单击删除您的表单应该现在加载,如果没有,保存项目,关闭它然后重新打开它。
回答by mehdi
i have this problem too . when i restart Visual Studio the form create successfully and show it's designer.
我也有这个问题 。当我重新启动 Visual Studio 时,表单创建成功并显示它的设计器。
回答by Mahib
I've created the Form with a different version of VS, other than 2012 (eg VS 2010, VS 2013, VS 2015; I've used VS 2015). Save the Form in the solution, open the solution with VS 2012 and include the form in the solution. It worked for me.
我已经使用 2012 年以外的不同版本的 VS 创建了表单(例如 VS 2010、VS 2013、VS 2015;我使用过 VS 2015)。将表单保存在解决方案中,使用 VS 2012 打开解决方案并将表单包含在解决方案中。它对我有用。
回答by betrice mpalanzi
To fix the problem you need :
要解决您需要的问题:
1) NotePad++
1) 记事本++
And you should follow this simple steps :
您应该遵循以下简单步骤:
1) Close Visual Studio .
1) 关闭 Visual Studio 。
2) Go to the Backup Folder of your VS version usually in : "C:\Users(your user name)\Documents\Visual Studio (year)\Backup Files\your project or application name" .
2) 转到您的 VS 版本的备份文件夹,通常位于: "C:\Users(your user name)\Documents\Visual Studio (year)\Backup Files\your project or application name"。
3) Open the last Backup file of your corrupted file , usually the name format is : "Recovered-month.-day-year-time.(Your File Name).cs" with NotePad++ , and copy the source code .
3) 用 NotePad++ 打开您损坏文件的最后一个备份文件,通常名称格式为:“Recovered-month.-day-year-time.(Your File Name).cs”,并复制源代码。
4) Go to your corrupted file in the project folder and open it with NotePad++ , Edit => Select All => Past the source code and Save .
4)转到项目文件夹中损坏的文件并使用 NotePad++ 打开它,编辑 => 全选 => 粘贴源代码并保存。
5) Go to windows start list and search for : "Visual Studio Tools" folder , open it and double click on : "Developer Command Prompt for VS(year)" .
5)转到Windows开始列表并搜索:“Visual Studio Tools”文件夹,打开它并双击:“VS(year)的Developer Command Prompt”。
6) Write this two codes in the Developer Command Prompt : "devenv.exe /setup" and then "devenv /resetskippkgs" .
6) 在开发人员命令提示符中写入这两个代码: "devenv.exe /setup" 然后是 "devenv /resetskippkgs" 。
7) Open your project .
7)打开你的项目。
Note : if this didn't work for you try to do the steps before in this arrangement :
注意:如果这对您不起作用,请尝试在此安排中执行之前的步骤:
1) => 2) => 3) => 4) => 7) => 1) => 5) => 6) => 7)
1) => 2) => 3) => 4) => 7) => 1) => 5) => 6) => 7)
and your problem will be fixed .
你的问题将得到解决。
It works 100% for me , i hope this will helps you
它对我来说 100% 有效,我希望这会帮助你
回答by jeff
Try changing the security permissions on the form affected. Right click the file, go to properties then security and change the access ability to everyone.
尝试更改受影响表单的安全权限。右键单击该文件,转到属性,然后转到安全性并将访问权限更改为所有人。