voglio mostrare i risultati di questo codice nel mio TextBox:C# Mettete stringa in TextBox
string txtout1 = txtOrgText.Text.Replace(parm, txtTo.Text).ToString();
txtout = txtout1;
ho una casella di testo, txtOrgtext
, in cui l'utente immette del testo. Voglio mettere del testo in txtout ora. Ho impostato txtout su ReadOnly e MultiLine.
Quando ho provare a eseguire il mio programma, ottengo il seguente errore:
Error 1 Cannot implicitly convert type 'string' to 'System.Windows.Forms.TextBox' C:\Users\xxx\AppData\Local\Temporary Projects\WindowsFormsApplication1\Form1.cs 45 25 WindowsFormsApplication1
ho provato txtout1.ToString()
, ma non cambia nulla.
Ho anche provato txtout.Text = txtout1
e ottenere questo errore:
Cross-thread operation not valid:
Control 'txtout' accessed from a thread other than the thread it was created on.
ho ottenuto un errore perché ho usato Threading, senza Threading funziona benissimo.
si prega di indicare chiaramente quando si modifica il tuo post ... –
Questo dovrebbe aiutarti. http://msdn.microsoft.com/en-us/library/ms171728(VS.80).aspx – Travis