-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Description
Scenario:
You are working on a Visual Basic .NET Framework 4.8 application (Hello) and using Roslyn to compile dynamic source code into a standalone executable (Hello.exe) for Windows.
Problem:
When compiling controls property assignment statements with Roslyn, some lines compile successfully, while others do not. For example:
Button1.BackColor = System.Drawing.Color.LightBlue(COMPILES)Button1.TextAlign = ContentAlignment.MiddleRight(DOES NOT COMPILE)
Question:
What is the correct Visual Basic statement for setting Button1.TextAlign so that Roslyn will compile it successfully?
Details:
- The problematic line fails during Roslyn compilation.
ContentAlignmentis referenced directly, as in the designer code, but does not compile dynamically.- Please clarify what statement or reference will work for setting the
TextAlignproperty during runtime when compiling with Roslyn.
Context:
- The goal is to dynamically compile source code for a Windows Forms application using Roslyn.
- Some property assignments (BackColor, etc.) work; others (TextAlign) do not.
Request:
- Provide the correct syntax or approach to assign
Button1.TextAlignin code that Roslyn will compile successfully. - If there are references or import statements required, please specify.
- Any alternate solutions or workarounds are appreciated.
Reactions are currently unavailable