I would not be surprised if this code actually ran faster than most other schemes. But, for a battery gauge?
rtklueh
Posts
-
Efficiency redux -
DataSet HasChanges doesn't pick up changes made by bound TextBoxesThanks everybody for the comments. It looks like the 'Enter' event for each of the tab pages occurs before the controls on that page are updated from the DataSource. And it looks like the 'SelectedIndexChanged' from the tab control occurs after the updating. So, I can set a flag while any of the pages are being updated and ignore any of the 'changed' events from any of the controls during that time. Not too pretty, but it seems to do the job.
-
DataSet HasChanges doesn't pick up changes made by bound TextBoxesI think it's strange that I wrote my own control, sort of an editable list control thing (I don't like the DataGrid), and it seems to set the DataSet HasChanged properly (I think because my control does BeginEdit and EndEdit). I don't understand why the TextBox doesn't do as well? Like the English guy with the vacuum cleaner says, 'things just ought to work properly'.
-
Hide control inherited from a base form in a specific derived form, this at design-time !I suspect you must have some reasons for not doing this, but wouldn't this be more straightforward if you just stripped the controls from the base form that don't actually appear on all the derived forms, and just leave a hole where these replaceable controls go?
-
Windows ServiceYou can attach the debugger to the service after it is running, and then set breakpoints in it to stop it and look in on things. If you need to see what it is doing when it first starts up, then just add some code to your service to sleep for a minute or so to give you time to attach the debugger right after you start the service.
-
DataSet HasChanges doesn't pick up changes made by bound TextBoxesI think I am actually doing the equivalent. I'm loading the DataSet in formload, and then I disable the 'apply' button (or 'save', etc). Then, any subsequent edits of the TextBoxes will raise their TextChanged events and I can then enable 'apply'. The problem shows up on the additional tab-pages that I have on the form. Their TextBoxes don't seem to receive the bound data until the user clicks on the tab-page, and this raises their TextChanged events. And this seems to occur after the tab-page's Enter event is raised, so I can't find a good place to re-disable the 'apply'.
-
DataSet HasChanges doesn't pick up changes made by bound TextBoxesI've seen this question in various forms in several places, but I have yet to see a satisfactory solution. Using .Net Framework 2, I've got a DataSet with elements bound to several TextBoxes which are scattered on several tab pages on a form. I can then change any of the TextBox texts, and the corresponding changes do appear in the DataSet. I want to enable an Apply button when any of these elements have changed. I tried to use the DataSet's HasChanges, but it will not return a 'true'. I also tried a RowChanged event on one of the DataTables in the DataSet, but it never triggered. I tried to resort to using the TextChanged event from all the TextBoxes. That almost works, but the event is raised when the binding initially sets the TextBox contents. I can tolerate that on the first tab page of my form, but the TextBoxes on the other tab pages don't get set until you initially select those tabs, and it is difficult to distinguish between a user-initiated change and the original setting. Thanks for your suggestions.