1
Reply

Updating form after making changes to controls

csc 0

csc 0

Jun 22 2004 6:15 PM
1.4k
Hi, I have a namespace containing two classes. One class handles the form generation and has a method for changing the text in a combobox. The other class gets info from the registry. I have created an instance of the first class within the second class, used this to access the method. It appears to work because a console writeline gives me the correct value for the text before update so I know the value is getting through. Also a messagebox after the text change gives the correct value. Can someone please tell me how to 'refresh' the form on the screen? Code (severely edited to save space below) namespace AVMonitor { public class FormUserInfo : System.Windows.Forms.Form { public void settboCurrentDatVerText(string strCurrentDatVer) { Console.WriteLine(strCurrentDatVer); this.tboCurrentDatVer.Text = strCurrentDatVer; MessageBox.Show(tboCurrentDatVer.Text); this.Refresh(); Application.DoEvents(); } } public class AVDetails { public static void Main() { AVMonitor.FormUserInfo FUI = new FormUserInfo(); //? apply values to form FUI.settboCurrentDatVerText("test"); Application.Run(new FormUserInfo()); } } }

Answers (1)