Replies: 5 comments
-
@Johmi cannot reproduce the issue based on your description as below screenshot, and attached the reproduce application, please correct it if there have anything is missing. |
Beta Was this translation helpful? Give feedback.
-
Hello @Zheng-Li01, I downloaded your Repo and tested it - you are right that it is running fine. However it seems that the WinForms Designer is not used. I installed the nuget "Microsoft.WinForms.Designer.SDK" Version="1.6.0" to your problem and got the same error that I described above. In your gif it is also visible that there is no red square painted on the Textbox in the designer (like in the screenshot in my initial post). This square only appears after using the Designer.SDK. Here is the modified .vbproj of your project. I did not change anything else:
I also attached the repo that I used to reproduce the error on my home computer right now (it is the same code but created and executed on a different machine). Maybe it helps. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@Johmi We have a different designer model to support .NET in the Visual Studio, please see https://devblogs.microsoft.com/dotnet/state-of-the-windows-forms-designer-for-net-applications/ |
Beta Was this translation helpful? Give feedback.
-
@Tanya-Solyanik Hello Tanya, thank you for your reply. In my .vbproj you can see that I am using the required nuget for the new designer. "Microsoft.WinForms.Designer.SDK" Version="1.6.0" In his article Klaus describes what has to be done to add some simple extensions to the designer. To my understanding it should be quite easy to do small things like using action lists and the existing glyph on controls (this little triangle button) or painting on controls in the designer (as I am doing in my code above). Also note that the designer does not cause problems when starting the application as long as I dont use databinding on controls using the designer. I think this might be a bug. If you need any further information, dont hesitate to ask. |
Beta Was this translation helpful? Give feedback.
-
Environment
Microsoft Visual Studio Professional 2022 (64-bit) - Preview
Version 17.13.0 Preview 5.0
.NET version
.NET 9
Did this work in a previous version of Visual Studio and/or previous .NET release?
Unknown
Issue description
I have a simple winforms program which contains a custom TextBox (MyTextBox) using a TextBoxDesigner (that inherits the ControlDesigner). The Designer just draws a rectangle on the MyTextBox for simplicity.
There is a Form with a MyTextbox as well as a normal Textbox.
My ViewModel contains just a Property "TextValue". Both textboxes have Databinding to this Property. When I enter anything in the normal Textbox, the Text appears also in the custom MyTextBox.
When I look at the Program in the Winforms Designer, everything is fine:

I can also compile the program.
When I run the program I get this error:

This error happens when I create the databinding for the custom MyTextBox.

When I remove the databinding, then the program is starting without issues (aside from the missing databinding).
Is there any way to get rid of this problems?
Steps to reproduce
Here is the full code that causes the issues. The error also occures in my main program, but this small code is more easy to reproduce:
Form:
ViewModel:
MyTextBox:
Designer:
Diagnostics
Beta Was this translation helpful? Give feedback.
All reactions