Here are the steps I have used to create the winforms Project OneB
Using Visual Studio 2019 with Net 4.8 I created OneB
Then I created a Windows Forms Class Library named CLP.
Opened OneB and Added Existing Project CLP and then Added Reference to CLP.
Here is the code in OneB The issue is with this line of code form.Show();
namespace OneB
{
public partial class frmStart : Form
{
string SS;
public frmStart()
{
InitializeComponent();
}
private void btnClose_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void btnShowLib_Click(object sender, EventArgs e)
{
SS = "HI we are from OneB";
var form = new CLP.Form1();
form.UdpateTextBoxWith(SS);
form.Show();
}
}
Now the code in CLP the Class Library
This code references a textbox1 BUT the project has no Form that the textbox1 can live on.
namespace CLP
{
public class Form1
{
private object textbox1;
private object newText;
public object SS { get; private set; }
public void UdpateTextBoxWith(string v)
{
newText = SS;
textbox1 = newText;
}
public void Show()
{
// This is intelesense suggestion YEP it throws
throw new NotImplementedException();
}
}
OK Number of Issues here
How do I call the Class Library ?
With NO form to show the textox1 text change should I be using a Control Library ?
This is just a test project my final goal is to use a Library Class or Control Library to
call CRUD methods for a SQLite DB
Side NOTE I made this change from 5 to 4.8 in both projects
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>