资源错误!“资源”不支持重复项目。参数。 [英] Resource error !Duplicate items are not supported by the "Resources" parameter.

查看:78
本文介绍了资源错误!“资源”不支持重复项目。参数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个大问题......我正在编写一个有多种形式的项目......

我有一个带有2个孩子的admin.cs:Admin.desighner.cs和admin.resx ..所以,当我点击一个按钮这个表单出现..但当我点击另一个按钮,我需要显示相同的表格,但没有一些额外的..(我不应该使用visibile,或禁用/启用类),所以我复制粘贴这个Windows窗体在同一个项目,但与其他名称,例如admin1.cs ...当我编译它说:



错误MSB3105:在Resources参数中多次指定了项目........ /。admin.resources。 资源参数不支持重复项目。



请帮助我如何解决这个问题... bcos如果我不这样做我需要写这么多代码..只是我需要像管理员一样制作相同的表格,但我会删除一些功能..非常感谢

Hello everyone, i have an big problem... i am writing a project with multiple forms...
and i have a admin.cs with 2 childs : Admin.desighner.cs and admin.resx .. so, when i click in an button this form show up.. but when i click in another button i need to show same form but without some extras.. (i should not use visibile, or disable/enable class) , so i copy paste this windows form in same project but with other name, for example admin1.cs... when i compile it says :

error MSB3105: The item "......../.admin.resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.

please help me how can i solve this... bcos if i dont do i need to write so much codes.. just i need to make same form like "admin" but i will delete some functions.. thank you so much

推荐答案

而不是复制/粘贴表格在解决方案资源管理器中,最好的方法是创建一个新的空白表单,并将所有控件从第一个表单复制/粘贴到新表单。



这个它不会重复资源或尝试使用其他文件中的资源。您也可以直接在表单中复制/粘贴事件处理程序或任何后端代码,但您必须将事件处理程序重新连接到正确的方法。







虽然以上是复制表单的好方法,但它仍然提供了一些你想要避免的程序员,代码重复。您应该使用单个表单并使用enable / visible来更改功能。这降低了代码复杂性和重复工作。你应该检查你不能使用它的原因并尝试找到使用相同表格的理由,只是改变一下以适应新角色。
Instead of copy/pasting the form in the solution explorer, the better thing to do is to create a new blank form and copy/paste all the controls from the first form to the new one.

This way it doesn't duplicate resources or try to use resources from a different file. You can also copy/paste the event handlers or any back-end code in the form directly, although you will have to re-wire the event handlers to the proper methods.



Although the above is a good way to duplicate a form, it still presents something you want to avoid as a programmer, code duplication. You should be using a single form and the enable/visible to change functionality. This reduces code complexity and duplication of work. You should review the reason you can't use that and try to find a reason to use the same form except just change things around to suit the new role.


这篇关于资源错误!“资源”不支持重复项目。参数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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