|
No problem. Actually, a correction, I think it will work on .NET 3.0+, but that still doesn't help you
|
|
|
|
|
Yes, you will need to exlcude it from obfuscation. BTW which obfuscator are you using? Crypto Obfuscator has a cool feature which lists all such code points which need attention.
|
|
|
|
|
My program has a class to do some analysis that is run on a separate thread. When the work is done, it raises an event called AnalysisDone which the main form then handles. Below is my code to handle the event.
Private Sub AnalysisDone() Handles DustWipeAnalysis.AnalysisDone
If Me.InvokeRequired Then
Me.Invoke(New AnalysisDoneDelegate(AddressOf Me.AnalysisDone))
Else
GenerateSummarySheet()
End If
End Sub
Now this function was working, but all of a sudden it is throwing a NullReferenceException at the Me.Invoke line. I don't understand why it was working and then just stopped when nothing was changed with the function, or the function that raises the event in DustWipeAnalysis class. Almost forgot, the AnalysisDoneDelegate is defined at the top of the main form as Delegate Sub AnalysisDoneDelegate()
|
|
|
|
|
Never mind I figured out the problem. I was trying to call the wrong object that was created on a separate thread and this caused the NullReferenceException.
|
|
|
|
|
At my company, we receive test results from a lab in Excel files. However, sometimes the files are saved in BIFF7 format which I cannot read with the tools I have (and I've tried several different ones), and I doubt the lab will change how they do things just for me. Is anyone aware of any third-party tools (preferably free or very cheap) that I can use to convert BIFF7 files to BIFF8 format or later? Right now I'm doing it with Excel automation but I would prefer not to do it this way if I don't have to. Thanks in advance.
|
|
|
|
|
Did you ask them whether they can provide BIFF8 consistently?
If you are ordering and paying for the tests, just specify you need BIFF8!
|
|
|
|
|
I have a request into them, but I trying to find alternates just in case they say they can't because of however they operate.
|
|
|
|
|
I just happend to encountere the same problem.
May I know how do you convert it using Excel automation?
I am trying to do so but failed. thanks.
|
|
|
|
|
Okay, I just started back working on my web browser, and I want to have my custom context menu show up when the user clicks inside the browser..... This is what I have...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Browser As New WebBrowser
TabControl1.TabPages.Add("New Tab")
Browser.Name = "Web Browser"
Browser.Dock = DockStyle.Fill
TabControl1.SelectedTab.Controls.Add(Browser)
AddHandler Browser.ProgressChanged, AddressOf Loading
AddHandler Browser.DocumentCompleted, AddressOf Done
Int = Int + 1
CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(UrlLocation.Text)
End Sub
That is where I suspect the bit of code will have to go... Since I'm using Tab Control instead of the WebBrowser...
Also, within the Context Menu, I am stuck on two parts...
Private Sub OpenLinkInNewWindowToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenLinkInNewWindowToolStripMenuItem.Click
End Sub
Private Sub OpenLinkInNewTabToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenLinkInNewTabToolStripMenuItem.Click
End Sub
What code would I add there to have it allow the user the option to open the Link in a new tab or a new window when they right-click over a link on the current webpage?
This is all I should need to complete my Web Browser for now.... Thanks.
~tbs
|
|
|
|
|
??
The way I create context menus does not involve any ToolStrip thingies. Just:
1. use MouseDown event
2. make sure the right mouse button is clicked
3. create a ContextMenu;
4. populate it (i.e. add menu items with their text, and attach a handler for them);
5. show it.
Something like this does the basics of step 4 (sorry, it's C#):
protected MenuItem addMenuItem(Menu menu, string text, Shortcut sc, EventHandler handler) {
MenuItem menuItem=new MenuItem(text);
menuItem.Click+=handler;
menuItem.Shortcut=sc;
menu.MenuItems.Add(menuItem);
menuItem.Enabled=handler!=null;
return menuItem;
}
PS: there probably is a more modern alternative, using a ContextMenuStrip instead op a ContextMenu;
I haven't used it yet.
|
|
|
|
|
Hi,
It's pretty easy. You need to first make a ContextMenuStrip and add it to the form. It looks like you've already done this because you showed event handlers for items. I'm going to call that ContextMenuStrip "myContextMenuStrip". Clever, huh?
OK, the WebBrowser object has a ContextMenuStrip property. If you can set it at design time, then do that. Otherwise, you can add it to your dynamically-created WebBrowser object:
Dim Browser as New WebBrowser
Browser.ContextMenuStrip = myContextMenuStrip
This assumes you are making a Windows Forms app. I don't think the WebBrowser control for WPF has this property. There are options though.
As for the code to open in a new window or tab, that is a bit more complicated. You would think it would be easy, but it's not really straightforward. Here's why: The WebBrowser control is only a wrapper to a single IE window. Tabs in IE are handled by the application. Each tab contains its own WebBrowser control. (It doesn't actually use the WebBrowser control as such, but this illustrates the point.)
So, the WebBrowser control that you put on your form doesn't know anything about tabbed browsing or other windows. If you want that behavior, you need to create it manually. For example, if you want to open a link in a new tab, you need to:
1) Ascertain the URL
2) Create a new tab
3) Create a new WebBrowser instance and put it on that tab
4) Navigate the new WebBrowser to the URL
It looks like you understand steps 2-4. If you need help finding the URL of the link, let me know.
Opening in a link in a new window involves a similar process:
1) Ascertain the URL
2) Create a new window
3) Create a new WebBrowser instance and put it in that window
4) Navigate the new WebBrowser to the URL
Good luck.
|
|
|
|
|
Well, My main goal right now is to get the custom context menu to work. It didn't show up with the code you supplied. As for the other codes, those can come with time.
|
|
|
|
|
Hmm ... I just did it to verify that it works.
Do this:
- Create a new Windows Forms Application.
- Add a tab control to Form1 with a tab named "TabPage1"
- Add a ContextMenuStrip control to Form1 named "ContextMenuStrip1"
- Add an item to the ContextMenuStrip. (I made an item labeled "Test".)
- Add the following code to the form:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Browser As New WebBrowser
Browser.IsWebBrowserContextMenuEnabled = False
Browser.ContextMenuStrip = ContextMenuStrip1
Me.TabPage1.Controls.Add(Browser)
End Sub
- Run the app, and right click on the browser.
It works perfectly for me.
modified on Monday, August 30, 2010 8:22 PM
|
|
|
|
|
It didn't work. please can someone figure this out?
|
|
|
|
|
This has already been figured out. The solution I gave you works. If you want more assistance, you should provide more information other than, "It didn't work." Then, perhaps I, or someone else, can tell you why it didn't work for you.
The solution I posted it how it is done though. I have done this in two commercial apps, and recoded a simple project (as I described) to verify I didn't miss any steps in describing it to you.
Is it possible you are building a WPF app? As I mentioned earlier, the procedure is different for WPF apps.
|
|
|
|
|
I am building a Windows form, and I am using the Tab Control.
|
|
|
|
|
If you followed the example I gave, my guess is that you did not follow it exactly. The example, as I gave it worked. Howevever, if you subsequently call WebBrowser.Navigate() to go to a web page, then the web browser's built-in context menu kicks in.
My guess is that you didn't try the example as I gave it, or you did, it worked, but then when you tried to incorporate the concept into your application (where Navigate() is called) it stopped working there. That is just my guess though since you haven't really given much information.
In any case, I modified the example by adding the line:
Browser.IsWebBrowserContextMenuEnabled = False
... which will disable the default context menu so that it won't override after you have navigated to a page.
|
|
|
|
|
The only thing is that I am not starting off with a pre setup tab page, it loads the page when the program starts, basically it doesn't have TabPage1 in it, now how can I get the context menu issue to work?
EDIT: Okay, well I thought about it a bit, and I was able to figure it out, using your example and adding a twist which actually happened to work. So I don't need that first TabPage1 anymore, thanks for the help, so now 50% credit to you and 50% credit to me for getting it without TabPage1 lolz.
Now all that I need is that Open link in new tab or window part to work, also that I need to figure out how to program Zoom in and Zoom out, and reset functions, and how to program a Find function, then it will be complete.
modified on Saturday, September 4, 2010 1:44 PM
|
|
|
|
|
It doesn't matter. I was just giving you that simplified example to show you that the approach works. The key is to do the following:
Browser.IsWebBrowserContextMenuEnabled = False
Browser.ContextMenuStrip = ContextMenuStrip1 ' or whatever your ContextMenuStrip is called
Nothing could be simpler. Have you even tried this?
|
|
|
|
|
yes I did, please check my modified post.
|
|
|
|
|
I have been thinking of creating a skinnable application whose skin (the toolbar images) are provided in some sort of "skin file". The problem is, I want all of the images and any other info (like an XML document containing the button fore/back colors to be used) to be grouped into one single file. (Like when you zip many files using WinZip to a single archive file). But I can't open those zip files from VB.
So is there any way to accomplish this task ? (preferably using some kind of open source external library, if one is needed).
(VB 2005, .NET Framework 2.0)
modified on Tuesday, August 24, 2010 7:45 AM
|
|
|
|
|
Pamodh wrote: Like when you zip many files using WinZip to a single archive file
That's what the modern Office-versions do. SharpZipLib[^] would be my choice
I are Troll
|
|
|
|
|
Thanks for the info and the link! I'll try out.
Pamodh.
|
|
|
|
|
You're welcome
|
|
|
|
|
I tried it out and the Zip library works great!!
Thank you so much.
|
|
|
|
|