How to capture response from Cancel or Ok Button in two different Applications? - vb.net

With my Application (vb.net) I am trying to scan Excel files some of which have ActiveX Components.
When running my Application, I am getting a pup-up window in Windows Vista Environment with Office-2007 having button OK and Cancel button to proceed.
But my problem is the scanning is not proceeding even after I keep on pressing the OK button. Now I want to continue with my application while pressing the Cancel button; i.e. just to skip the file. Is it possible to capture the response from the cancel button? (As this is a message box from another application, i.e. either from Vista or Office-2007, I'm not sure).
My main motive is to just ignore the message box to proceed....
Can anyone please help me out there....
Thank you....

The DisplayAlerts property of Microsoft.Interop.Excel.Application may help here.
If set to FALSE then Excel automatically chooses the default option on pop-up boxes.
Whether or not this applies to ActiveX controls I don't know but it may be worth trying.

Related

Opened form won't reactivate after closing modal

Within VB.NET Visual Studio 2013
I have an mdi application with several forms. Only one form is open at a given time, then while the user enters amounts by typing in the control, the form is recalculating itself constantly via code.
I also have buttons above (on the mdiform) to open modal dialogs to enter certain information; the information entered is somewhat long, but at the end what I need from the dialog is the result of certain calculation.
That number (the result) should be shown on the opened form after the user close the modal dialog; but it is not happening unless I press the enter key so the form is again recalculated.
I am looking for a way that the form recalculate when the user close the dialog.
I tried everything at my disposal, "Activate", "a public sub", "raise an event", and many others, but the form is not recalculating, what happens is that the cursor is there on the last control the user works in.
The only way to see those changes is reloading the form, but it is not elegant.
Any help will be highly appreciated.
PS. I have looked everywhere about how to do it, but seems I am looking on a haystack
Please need help badly.
ariel

Visual Basic : How to Block all message boxes, popups and alert dialog

I am making a webbrowser using VB 2010, and I often see popups regarding script errors or advertisement when browsing. I want to disable all message boxes and script error boxes too. I do not want to stop or block scripts from running, I want browser to continue running them but not to show the popup alerts.
WebBrowser1.silent = True isn't working
Thanks in advance
You have tagged this as VB.NET, which I believe is incorrect. In .NET you would use webBrowser.ScriptErrorsSuppressed = true as shown here: Disable JavaScript error in WebBrowser control
The Silent property is available on the ActiveX web browser control in VB6 and probably VBA (?). I believe there is a problem with setting Silent to true there, because it gets set back to false at run time whenever the control is loaded. There is an example on how to work around that by using a timer control, which is available here: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=43907&lngWId=1

Sheet-related processing causes Excel VBA Userform to stop processing Tab/Enter

This is a distilled form of a problem I'm having with a real application. Under certain circumstances, the initialization/activation code of a userform might result in the form losing its ability to correctly process tabs and enters: rather than switching between controls, these keys are passed to the controls themselves (even if they have TabKeyBehavior set to False). The simplest way I've found to systematically reproduce the problem is by having this at activation time:
Private Sub Userform_Activate()
Application.DisplayDocumentInformationPanel = True
End Sub
which seemingly causes Excel to "half-steal" the focus from the userform, so to say: the userform remains focused but tab/enter processing fails. The problem immediately goes away by switching to some external app and getting back to Excel (pressing ALT+TAB twice, for instance.)
Steps to reproduce the problem:
Download tabnotworking.xlsm.
Open tabnotworking.xslm.
Enable macros.
Click on the "Launch UserForm1" button.
UserForm1 is displayed and the textboxes accept input from the user, but tab/enter does not work as expected.
Press ALT+TAB twice or click on some external app and get back to the form: now tab processing works OK.
Once tab/enter processing has been restored, further usage of the form, including relaunching it, seems to work OK (most of the time). To reliably reproduce the problem again, close the book and start from step 2.
There are numerous references on the Internet to problems with tab processing seemingly related to this one, but no actual solution. Any clue on what's happening and how it could be solved? Thank you,

How to determine which form controls the keyboard input on VB.net

I'm developing a VB.net windows application and I have some issues with the keyboard input.
My application has different forms and I'm showing and hidding them with the user interaction. One of the inputs comes from the keyboard, and here is where I have a problem.
When I hide a form and show the next one, most of the times the new-shown form does not receive the keyboard input until I click somewhere on it.
I assume that the problem is that the new form I'm showing is not the "selected application" for windows until the user interacts with it by clicking on it, but I don't know how to set this "property" by code.
I tried with focus and select on the whole form (Me.select/focus) and in some form's control (me.lbl_xxx.select/focus), but I did not get any result.
Can anyone explain me how to control which application/form gets the keyboard input on windows?
Thanks
David
You can't really interact with a label so the input focus won't be set properly.
Focussing a specific textbox on your form on the other hand should just work fine.

Is it possible to have an extension library dialog box within a repeat control?

I'm running with an 8.5.3 UP1 server and I have a need to have many dialog boxes (for confirmation purposes) for a whole bunch of "action buttons" on an xpage. The code for these dialog boxes is almost exactly the same with the exception of the confirmation message being different and the client-side JS function they are calling if the Yes button is selected.
Since I really hate repeating code over and over, I was wondering if it is at all possible to put a xe:dialog control within a repeat control and specify the message and function call from an array of values? I know I can't compute the ID of the dialog control and without that I'm not sure how I would reference the dialog to open and close it.
Any ideas? Thanks
Yes, this is possible.
Make sure that you specify that the dialog box's property for keepComponents is set to False. You don;t have to do anything special for opening or closing the dialog box, just use whatever ID you give the dialog box in you client-side action to open the dialog box in the repeat such as XSP.openDialog('#{id:myDialog}')
The XPages renderer will automatically calculate the correct ID names for you.