I am trying to create a testing Solution, using Visual Studio 2019, (.NET Framework 4.7.2) that will test various small sections of code that will be used in a much larger Solution. The code below in Form1.cs should compile, but does not. I want to derive a string and then send it to textBox1.Text for visual verification.
The compiler doesn’t like the use of “.Text” in the third line of code and gives the following error.
error CS1061: 'string' does not contain a definition for 'Text' and no accessible extension method 'Text' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
Any thoughts?
C#:
using System; using System.Windows.Forms;
string txtout1 = “previously derived string”;;
string txtout = null;
txtout.Text = txtout1; // problem with use of .Text on this line
textBox1.Text += txtout;
error CS1061: 'string' does not contain a definition for 'Text' and no accessible extension method 'Text' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?)
Any thoughts?
Last edited by a moderator: