05-16-2022, 03:32 PM
Good day. This code seemed to have worked before, but now I'm getting the dreaded:
Here is a code snippet... This is inside an async Task<bool> method....
I put the "print.it" and "return" statements in to see if I was getting an error from the static method RequestLicense. But the exception moved to the print.it line for licenseName.Text. Thoughts for retrieving the value from the form and passing it to the static method?
Thanks!
System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
Here is a code snippet... This is inside an async Task<bool> method....
I put the "print.it" and "return" statements in to see if I was getting an error from the static method RequestLicense. But the exception moved to the print.it line for licenseName.Text. Thoughts for retrieving the value from the form and passing it to the static method?
Thanks!
C# code:
var b = new wpfBuilder("License Request Info").WinSize(400);
b.R.Add("Full Name", out TextBox licenseName).Focus();
b.R.Add("Email Address", out TextBox licenseEmail);
b.R.AddOkCancel();
b.End();
if (!b.ShowDialog())
return false; // quit
var isOnline = await CheckConn();
if (isOnline == true) { // we can communicate with the license server
print.it(licenseName.Text);
print.it(licenseEmail.Text);
return false;
var licReq = RequestLicense(licenseName.Text, licenseEmail.Text, "standard");