You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio中为Windows Form添加resx文件报错求助

Fixing the "destination folder is the same as the origin" Error When Adding Resx Files to VB Forms

Hey there! Since you're new to Visual Basic, this is a super common confusion when working with form resource files—let's break down what's happening and how to fix it.

Why You're Seeing This Error

The error message "destination folder is the same as the origin" means the resx file you created is already in the exact same folder as your form—you just can't see it at first glance!

In Visual Studio, form files (like Form1.vb) have their related resources hidden under a collapsed node. Click the small arrow icon next to your form's name in the Solution Explorer, and you'll probably see the resx file is already there, linked to the form.

The Correct Way to Add Resx Files to Your Form

Instead of creating a resx file separately and trying to move it, use one of these methods to let Visual Studio handle the association automatically:

Method 1: Add Resources Directly Through the Form

  • Open your form in the designer.
  • Right-click a blank area of the form and select Properties.
  • Switch to the Resources tab in the properties panel.
  • Here you can add strings, images, or other resources directly—VS will automatically create and link the correct resx file to your form, no manual moving needed.

Method 2: Manually Create a Linked Resx File

If you prefer to create the file first:

  • Right-click your form file (e.g., Form1.vb) in the Solution Explorer.
  • Select Add → New Item.
  • Choose Resources File from the templates.
  • Name the file to match your form exactly (e.g., Form1.resx; for localized resources, use Form1.zh-CN.resx for Chinese, etc.).
  • Click Add—VS will automatically nest this resx file under your form in the Solution Explorer, so you don't need to move it at all.

Quick Tip for VB Form Resources

Visual Studio uses naming and folder rules to link resx files to forms:

  • The resx file must have the same base name as your form (e.g., Form1.vb ↔ Form1.resx).
  • It must live in the same physical folder as the form file.
    When both conditions are met, VS will display the resx file under the form's collapsed node in the Solution Explorer.

内容的提问来源于stack exchange,提问作者Alessio Puliatti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 07:14:32