“没有可用于../Form1.vb的编辑器”。错误? [英] "There is no editor available for ../Form1.vb" error?

查看:1271
本文介绍了“没有可用于../Form1.vb的编辑器”。错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很高兴地使用VB.NET,保存了,并且有一次停电。



可能是幸运的吗?那么,现在我打开我的项目就好了,双击Form1.vb和....没有可用于../Form1.vb的编辑器,请确保已安装文件类型(.vb)的应用程序。



..........我的项目出了问题吗?是



Windows 7,Visual Basic 2010 Express。



我应该怎么做?

解决方案

很难想象你在看什么。我看到很多情况下,设计视图无论何种原因都无法打开,但我从未无法查看表单的代码



首先要尝试导航到Windows资源管理器中的项目文件夹,右键单击 Form1.vb 文件,然后尝试在记事本中打开它。这几乎是最终的考验。 如果您可以在记事本中打开它,则您的工作可以挽救。如果不是这样,文件已损坏,最好的选择就是重新开始。我想,如果你确实感到你有很多投资,你可以尝试各种文件恢复技术,但是考虑到它是一个单一的形式文件,我认真地怀疑它是值得的时间或费用。



如果成功,并且您在记事本中打开文件,选择所有代码并将其复制到剪贴板。现在回到Visual Studio中,并为您的项目添加一个新的 Form 。删除新窗体的代码文件中的所有内容,然后将原始窗体中的回收代码粘贴回来。尽管如此,您仍然无法在设计器中打开窗体,而且您可能会缺少对所有控件的引用。为了解决这个问题,你需要回到Windows资源管理器,找到一个名为 Form1.Designer的文件的.vb 。这是设计师存储信息的部分类;它包含所有控件的声明以及您在设计时为这些控件设置的属性。像以前一样,右键单击该文件并在记事本中打开它。选择所有内容并将其复制到剪贴板。现在回到Visual Studio,然后单击解决方案资源管理器顶部的显示所有文件按钮(将鼠标悬停在其上以阅读工具提示)。你会看到一堆额外的垃圾出现,但你最感兴趣的是在每个 Form c>类旁边出现的下拉箭头。展开您在上一步中添加的新表单,并找到它的 .Designer 文件。删除现在的所有内容,然后粘贴您打捞的表单的 .Designer 文件中的代码。

您现在在您的项目中拥有旧表单的精确副本。您可以删除旧的损坏的表单文件,因为您不再使用它。您也可能想通过在Solution Explorer中右键单击它来更改新文件的名称 - 现在它的名称为 Form1 ,就像您的旧表单一样,因为它是该表单的精确副本。该代码表示​​它的名称是 Form1 ,并且不会在乎您的文件名。清理并重建你的项目,如果事情按你的方式进行,一切都应该恢复正常。

I was happily using VB.NET, saved, and, well, there was a blackout.

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."

.......... Did something go wrong with my project? Is it dead?

Windows 7, Visual Basic 2010 Express.

What should I do?

解决方案

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 code for 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 really feel 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.

If that succeeds, and you can open 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.

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.

You now have an exact copy 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.vb的编辑器”。错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆