Control won't update
-
I built a control which I try to send a value to, however the control doesn't update. What must I do to have the value update. Within the main control I have a smaller numericUpDown control. I send the value to a method within the main control. Though the value is updated programtically, it does not update on my screen. The main control is set in a tab control on my form, yet was built in a separate library where I send the value to be updated. I made this as a control because I access it in 2 separate forms. Any help would be greatly appreciated. Michael
-
I built a control which I try to send a value to, however the control doesn't update. What must I do to have the value update. Within the main control I have a smaller numericUpDown control. I send the value to a method within the main control. Though the value is updated programtically, it does not update on my screen. The main control is set in a tab control on my form, yet was built in a separate library where I send the value to be updated. I made this as a control because I access it in 2 separate forms. Any help would be greatly appreciated. Michael
You didn't say what platform you are working on, but if it's WinForms, then you may need to
Refresh()
the control for the changes to be visible. If the program is busy doing other things, you may also need to useApplication.DoEvents()
to process any Windows messages that force the refreshing.CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
You didn't say what platform you are working on, but if it's WinForms, then you may need to
Refresh()
the control for the changes to be visible. If the program is busy doing other things, you may also need to useApplication.DoEvents()
to process any Windows messages that force the refreshing.CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
Yes I am using WinForms. I tried the above, and it still doesn't work. So I tried a few other things and when I tried the following: this.numericUpDownAccount.ActiveControl.Refresh(); It said I needed to use the new command. So I tried both the following: NumericUpDown numericUpDownAccount = new NumericUpDown(); and NumericUpDown numericUpDownAccount = this.numericUpDownAccount; and it still doesn't work. Michael
-
Yes I am using WinForms. I tried the above, and it still doesn't work. So I tried a few other things and when I tried the following: this.numericUpDownAccount.ActiveControl.Refresh(); It said I needed to use the new command. So I tried both the following: NumericUpDown numericUpDownAccount = new NumericUpDown(); and NumericUpDown numericUpDownAccount = this.numericUpDownAccount; and it still doesn't work. Michael
OK, I hope I understand you correctly. If not, please correct me or perhaps someone else will jump in. If it said you need to use the new command, it seems you need to create the control. You'll also need to add it to Controls list of its container. Once you do that you should be able to refresh the container and it should display your added control, assuming the control, is implemented correctly. You can look at the designer code for any Form to see how the controls are created and added to the list of controls, etc.
CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
OK, I hope I understand you correctly. If not, please correct me or perhaps someone else will jump in. If it said you need to use the new command, it seems you need to create the control. You'll also need to add it to Controls list of its container. Once you do that you should be able to refresh the container and it should display your added control, assuming the control, is implemented correctly. You can look at the designer code for any Form to see how the controls are created and added to the list of controls, etc.
CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
Yes I am using WinForms. I tried the above, and it still doesn't work. So I tried a few other things and when I tried the following: this.numericUpDownAccount.ActiveControl.Refresh(); It said I needed to use the new command. So I tried both the following: NumericUpDown numericUpDownAccount = new NumericUpDown(); and NumericUpDown numericUpDownAccount = this.numericUpDownAccount; and it still doesn't work. Michael
this.numericUpDownAccount.ActiveControl.Refresh();
numericUpDownAccount
is the name of your control and points thereto. ActiveControl is the current focused control, and might benull
. That's why we have a manual. Paste the entire method if it still does not work.Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
-
this.numericUpDownAccount.ActiveControl.Refresh();
numericUpDownAccount
is the name of your control and points thereto. ActiveControl is the current focused control, and might benull
. That's why we have a manual. Paste the entire method if it still does not work.Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
I Solved the probem, I realized after you wrote the above the control I am accessing is the original not the copy I added to my form, so I did the following in the form: this.ctrlMainControl1.numericUpDownAccount.Value = nAccountID; this changes he value of the copy of the control not the original control. Thanks, Michael