1
Answer

Change a value in a form from a different class

Jan

Jan

18y
2.4k
1
I have create a windows form frmAccount, in the form a have a richtextbox "rtxtLastScan" from the form I call (FileDirectory fd = new FileDirectory(); fd.timer(int.Parse(rtxtSeconds.Text), rtxtAccount.Text, strStartUpPath);) another class FileDirectory.cs. From this class i want to set rtxtLastScan´s value, I tried different ways but nothing seems to work. When i debugg i got down to ScanDirectory() and the code runs tro but the text in frmAccount rtxtLastScan doesn´t change. Could anyone help me? public class FileDirectory { string strStartUpPath = ""; Account myAcc = new Account(); frmAccount myFrmAccount; public void ScanDirectory() { myFrmAccount = new frmAccount(); myFrmAccount.rtxtLastScan.Text = "Hello"; } }
Answers (1)