How to create simple browser with Mozilla ActiveX Control with VB.NET? - vb.net

I download and install Mozilla ActiveX Control
and add MozillaBrowser Class to ToolBox
Create a windows form application windows, drag drop MozillaBrowser from ToolBox to Form1
also drag drop a WebBrowser1 to Form1
in Form1_Load write this:
WebBrowser1.ActiveXInstance = AxMozillaBrowser1
but Error Property 'ActiveXInstance' is 'ReadOnly'.
I want display a fix URL in Mozilla browser, Now I must what to do?

As I understand it this control is a direct replacement for the WebBrowser control so you should just add an instance of the control on your form and then something like this should work:
AxMozillaBrowser1.Navigate2("http://www.bbc.co.uk")
have a look at this wrapper which may help you on code project: http://www.codeproject.com/Articles/20312/Browsers-Wrapper-Mozilla-IE

Related

Coded UI Test Fails to find Wpf Popup Window controls

I am trying to automate a ribbon control in power point. In that ribbon there are popup windows which contains settings information, when I try to automation those setting popup windows using Coded UI, I got error message like "the control cannot be located playback fail to find control with give search properties", But Coded UI can find the popup window but it fails to find any controls inside it.I have already tried with
SearchConfiguration.AlwaysSearch and setfocus()
Does any one have solutions, it will be very helpful for me!
Find the parent object, i.e the popup window, and enumerate through the children objects manually if codedUI is not able to locate the objects.
IEnumerator<UITestControl> appt = uiMainWindowControl.GetChildren().GetEnumerator();

VS2010 VB.NET Winforms select startup form programmatically

I'm really struggling to find out how to dynamically load a form when starting a VB.NET winforms application in VS2010.
Looking at existing answers such as this: Programmatically change the startup form on application launch?
Has not helped. I do not have a main method (that I can see) in my winforms project and when I go into the project properties I can only select a start-up form. But I have one of two forms to display on start-up depending on the user accessing the application.
I tried to set a loading form up which, in it's load event would call .Show() on the correct loading form after it had determined it and then the loading form would close itself down, but doing this led to both forms being closed.
Below are steps for VS2010 VB.NET Winforms select startup form programmatically.
1 : Go to My project from Solution Explorer
2 : Click on Application Tab--->Uncheck Enable application Framework
3 : Then Inside module create Sub like this
Public Sub Main()
MsgBox("called Main") 'This is testing
Login.Show() 'Set your start up form here
End Sub
4 : Again My Project--->Application Tab--->Startup Object--->Sub Main
5 : Thats it, It will give you message box and will show Login form.
Hope It will help you.
Thanks
Mahesh
Nevermind. I found in the properties a button to generate the MyApplication class in which I can access the startup event.
Another option is to use an MDI form. When it loads you can determine which child form to display.
Using Sub Main is the way I have done this forever but for some reason, MS has decided to make the norm, difficult. To use the Sub Main way, create a "Module" if you dont already have one. Put this code in there:
Sub Main()
Stop
End Sub
Now, in your project properties, assuming your are doing a standard WinForms application, on the "Application" tab, uncheck the "Enable Application Framework". This will allow you to see (and select) "Sub Main" in the "Startup Object" drop-down.

Adding WithEvents to SerialPort object place on form in VB.NET

I have added a SerialPort object onto a form I created in a VB.NET solution. How do I add "WithEvents" to it, since I dragged it onto the form instead of creating it in code. Is it even necessary to do so?
Dragging it onto the form automatically adds it to the designer generated code as WithEvents - it has to or you wouldn't be able to hook up events in the Events pane. If you hit the "View All Files" toggle in the Solution Explorer you should be able to see the designer files. Have a look in there and you will find where the IDE adds this code.

How to export form as an image (not during runtime)

I'm using Visual Studio just to create GUIs for a project. There is no code, only the designs.
I need to convert these forms into images that I can paste into the report.
Is there a simple way to do this?
Thanks.
Edit: the only solution I have so far is to edit the project so that each window I want to export is the start up form, but I am going to have over 40 forms, so this will get tedious after awhile.
Create a new Class in your Projects, lets say Startup.vb, which looks something like this:
Friend Class Startup
<STAThread()> _
Public Shared Sub Main()
Application.Run(New Form1)
Application.Run(New Form2)
Application.Run(New Form3)
End Sub
End Class
In the Project Properties the general Tab, untick Enable application framework and choose Startup as new start-object.
Obviously you'd need to adjust your startup class to open all forms you wish to open. When running the application just press Alt+PrintScr to copy an image of just the selected Window/Form to the clipboard. Paste that back into the paint application of your choice. Microsoft Paint will do.
Using a screen capture program might be your best choice. Personally I recommend TechSmith SnagIt application. You can capture any selected region in the screen using this application.
If you right click on the form a select Lock Controls this will remove the resize handles you can then press PrtScn to take a copy.
Note: After applying Lock Controls it does still have a focus rectangle and lock symbol but these are outside the co-ordinates of the form so they could be cropped in MS Paint or similar?

Control a webbrowser openfiledialog Visual Basic 2010

Is it possible to control a openfiledialog which opens in the webbrowser
( example: www.tinypic.com )
i want to automaticly fill in the filelocation and than click 'Open'
No it wont work
It is a windows form class, so it doesnt work with web apps
you need to use an HtmlFileInput no alterantives unless you can use an ocx
or some java (not script).
this link may help as well
http://steveorr.net/articles/EasyUploads.aspx