Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Visual Studio Form Designer Error
 

Visual Studio Form Designer Error

Hello,
I am facing a tough issue when using WPF user control along with WinForms.

I am using Visual Studio 2008 SP1 on a PC with WindowsXP 2002 SP2.

Here's the problem.
1. Create a Win Forms Application with a single form (Form1).

2. Add a WPF user control named UserControl1 to the project. Code for UserControl1as show below

<

UserControl x:Class="WindowsFormsApplication1.UserControl1"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Height="Auto" Width="Auto">

<Grid>

<Grid.ColumnDefinitions>

<ColumnDefinition />

</Grid.ColumnDefinitions>

<Grid.RowDefinitions>

<RowDefinition />

</Grid.RowDefinitions>

<TextBox Grid.Column="0" Grid.Row="0" Text="User Control 1"/>

</Grid>

</

UserControl>

3. Add another WPF user control named UserControl2 as show below

<

UserControl x:Class="WindowsFormsApplication1.UserControl2"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

xmlns:my="clr-namespace:WindowsFormsApplication1"

Height="Auto" Width="Auto">

<Grid>

<Grid.ColumnDefinitions>

<ColumnDefinition />

</Grid.ColumnDefinitions>

<Grid.RowDefinitions>

<RowDefinition />

<RowDefinition />

</Grid.RowDefinitions>

<TextBox Grid.Column="0" Grid.Row="0" Text="User Control 2"/>

<my:UserControl1 Grid.Column="0" Grid.Row="1"></my:UserControl1>

</Grid>

</

UserControl>

4. Now add UserControl2 to Form1.

5. Rebuild All. and try to open Form1 inthe designer again. the following errorappears.
The component 'WindowsFormsApplication1.UserControl1' does not have a resource identified by the URI '/WindowsFormsApplication1;component/usercontrol1.xaml'.
Instances of this error (1)
1.
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at WindowsFormsApplication1.UserControl1.InitializeComponent() in e:\Musthafa\VisualStudioTest\WindowsFormsApplication1\UserControl1.xaml:line 1
at WindowsFormsApplication1.UserControl1..ctor() in E:\Musthafa\VisualStudioTest\WindowsFormsApplication1\UserControl1.xaml.cs:line 24
Help with this error
Forum posts about this error
The variable 'userControl21' is either undeclared or was never assigned.


Hard Core Soft Ware
musthafa manikkoth  Thursday, April 16, 2009 12:57 AM
Hi Matt,


I can reproduce the problem. But when I run the application, it can still display well. It might be an design time issue about Visual Studio. Please feedback in Microsoft Connect Portal . Engineers there will confirm you with this. They will take this into serious account when designing future releases of the product.

Improving the quality of the products and services is a never-ending process for Microsoft. Thanks again for choosing us.

Best regards,
Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't.
Bruce.Zhou  Thursday, April 23, 2009 3:04 AM
Hi Matt,


I can reproduce the problem. But when I run the application, it can still display well. It might be an design time issue about Visual Studio. Please feedback in Microsoft Connect Portal . Engineers there will confirm you with this. They will take this into serious account when designing future releases of the product.

Improving the quality of the products and services is a never-ending process for Microsoft. Thanks again for choosing us.

Best regards,
Bruce Zhou
Please mark the replies as answers if they help and unmark if they don't.
Bruce.Zhou  Thursday, April 23, 2009 3:04 AM

You can use google to search for other answers

Custom Search

More Threads

• display datagriview in panel control
• Help with Data Export via VS2005
• UITypeEditor ListBox help needed how to implement this.
• Adding Design mode (Toolstrip) on C# Windows Custom Control
• Opening property pages via the property browser problem
• serching listview
• VS2005 - Form Design error !
• openFileDialog (help with Declaratoin) Thxs
• combobox
• Disable design time support for child controls