Refresh GUI when a status changes - lotus-domino

On a SubForm, a hidden field carrying a status flag is changed at runtime. The content of the form has to change accordingly. When I call RefreshHideFormulas on the UIDocument, the GUI doesn't change. The documentation says that this method take effect only when the user exists the current field, which is indeed happening when I do that manually.
But I need the GUI to be updated automatically after the status changes. I tried this:
Sub RefreshHideFormulas
Call uidoc.RefreshHideFormulas()
Call uidoc.GotoNextField
Call uidoc.GotoPrevField
End Sub
But it didn't work either!
I their a better solution for this?

I found the solution here. I just made the thing more complicated that it is because I've read in the wrong direction. The solution (posted here for the record) is as simple as calling refresh instead of RefreshHideFormulas:
Call uidoc.Refresh

Related

Write Conflict Error in Access Resolved Once After Saving Class Module

I have a form for viewing data in a table, which can open a pop up form to edit the data.
When data is edited in the pop up form, Access throws a write conflict error upon closing that form and returning to the original.
The strange behavior I'm experiencing is that when I make a change to the popup's class module in VBA, even if I immediately undo the change and save, the error will be resolved exactly once.
To be clear:
I make a change to the popup's class module in VBA (even a change I immediately undo and re-save)
I can open the pop up from my original form, edit records, then close the pop up. No error is thrown on closing the pop up.
I then open the pop up and edit records a second time. Then upon closing the pop up a write conflict error is displayed. This continues each subsequent time.
I now make a change to the popup's class module (again, even a trivial one), the error is resolved for one edit again, and the process repeats.
Does anybody know why this behavior could be occurring? Any help would be much appreciated.
Well the issue centers on if two users, or in this case two bits of code try to edit a record that is already dirty.
If the main form causes the record to become dirty (changed, but not saved), if then you run ANY other code that ALSO changes that data, then you get the conflict.
The simple solution then is to ALWAYS ensure that the the current forms record is safely tucked away and saved before you run + call code that might change that dirty record. And that includes that popup form + class.
So in your code that launches the form/class code? Do this RIGHT BEFORE you launch that 2nd form:
If me.Dirty = True then me.dirty = False
So, the above will safe write out the dirty record, and now you are free to launch/run any other code that might change that record. And because you run the above? Well, the record is not dirty anymore, and thus you should not see nor receive a write conflict error.
So adding a check to save if dirty before you launch/run that additional code/form will resolve this issue. In fact, as a habit, for just about "any" launching of additional UI forms, it a good idea to safe tuck away and save the current forms record when launching additional UI bits and parts.

Reset usercontrol placed on form

Probably simple question but couldn't find any working solution. I have User control on windows form. I would like on button click placed on user control to reload user control. By reload i mean to reset all its variables and show again. How to achieve that?
There is nothing that does that. You could dispose the existing control and create a new one but noone would do that. Basically, it's a manual process. If you want the control's fields reset to defaults then you need to write code to do that. You might declare a Reset method and put all the code in there if that's appropriate and then you can simply call that method from the form.

How do I hide a button when printing?

After searching for a solution on the internet, I found this on CodeProject from 2007:
VisibleWhilePrinting = false
This does not seem to exist in VB.Net. Is there something out there that I can use to hide a button when printing a form? (other than manually setting the button's "visible" property to hidden every time the form is printed).
Thanks.
Why don't you create a method that handle's this type of behaviour? The code you provided is probably a variable that is referenced somewhere in the code to determine what needs to take place, for ex:
Dim VisibleWhilePrinting As Boolean = False
Then this can be used or set anywhere and then used where you need it to. In order to hide a button just depends on why you need to hide it. As you have already stated about the visible property of the button itself. So as I have said, create a method and call it or a function...
UPDATE
As #varocarbas has mentioned, there isn't a automatic way of acheiving this, only manually.

Findrecord always go to first record before the good one

I got a problem with a form showing the follow ups of a proposal.
I made a form where you can navigate to the next follow up and the previous one.
The problem is that when I use the navigation buttons, it adds a follow up to the current proposal.
I realized that the follow up created is always the same one (the id is 83) and actually it's one made for another proposal. So every time I navigate, it updates this particular follow up and change the proposalId for the current.
here's the code for one of the navigation button:
Private Sub btnShowPrevious_Click()
Save
FindRecord "ID", txtParentID
End Sub
Because the wrong id is always the same (83), in the current form event I added an alert and found out that before to show me the good follow up, it always go to the 83 for a millisecond.
here are the steps to get this weird behavior
create new follow up and save
create his child and save
close the form
open parent or child follow up
use the navigation button
then it goes to the 83 before to show the good one.
If i press again any navigation buttons, it won't happen.
And if I don't close the form after saving and use the buttons, it works.
it's like if there's a default follow up id while he's looking for the follow up I request.
I don't know if it's clear.
I set the fetch defaults, the filter on load and allow filters properties to "No".
Also, when I open the form in view mode from the design mode, the default record is the 83.
so why when I do a findrecord it goes to the default record before to go to the good one?
EDIT
Finally, it's always the first record
Why it shows the first record when I do the findrecord before to find the good one.
Does anyone have an idea why this is happening
Thank you.
I got it...
I tested it in another project and while I was writing Findrecord I noticed some parameters were missing.
I checked and it was a method I made ( I don't remember why I made my own method for this)
There was a Me.Filter = "".. that was reloading the form to the first record.
Thank you

How do I force a page to refresh the data upon reload after entering new record

When I create a new record by submitting an .aspx page the new record is not showing up. I have to navigate away from the page and back to it for the new data to show.
How do I refresh the data up reload??
i think you need to call databind() on your grid. If that's an unlucky guess, we're going to need more context - can you please post your code (aspx and vb)
try Application.doEvents() right after you update the object in your code.
It's a shot in the dark really since we really don't know what you're code is doing, but if I ever have problems with something updating in VB.net, 9 times out of 10 calling that method fixes it.
You will need to call DataBind() on whatever object your using for your data connection, and then you will have to refresh the page unless your using AJAXified controls inside of an UpdatePanel that has a trigger set to your submit button. But without a code listing, knowing how your talking to the database, or anything of that sort, its really hard to give any code that will help.