Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Visual Basic Programming

Visual Basic Programming Discussion forum for Visual Basic, an event driven programming language and associated development environment from Microsoft for its COM programming model.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old 08-29-2006, 07:02 AM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 11
brackett is on a distinguished road
Default

The exception indicates that either WebBrowser1 or WebBrowser1.ActiveXInstance is null...I'm not sure which one, though. If you put a breakpoint on that line and debug, you can use the immediate window to run the following 2 commands:
Code:
?WebBrowser1
?WebBrowser1.ActiveXInstance
One of those should be null (or Nothing). Alternatively, I suppose you could just add an assert:
Code:
Public Sub New()
        InitializeComponent()
        ' Cast to WebBrowser, so that we can subscribe to the NewWindow3 event
        Debug.Assert(WebBrowser1 IsNot Nothing)
        Debug.Assert(WebBrowser1.ActiveXInstance IsNot Nothing)
        AddHandler DirectCast(WebBrowser1.ActiveXInstance, SHDocVw.WebBrowser).NewWindow3, AddressOf WebBrowser1_NewWindow3
End Sub
What I meant by default URL is to set the Url property of WebBrowser1 to something in the Designer's PropertyPane. That'll give it a Url in the InitializeComponent() method, which is how I did it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #22 (permalink)  
Old 08-29-2006, 11:12 AM
CheeseBurgerMan CheeseBurgerMan is offline
Learning Programmer
 
Join Date: Jul 2006
Posts: 78
Rep Power: 9
CheeseBurgerMan is on a distinguished road
Default

Thank you very much for the help. Everything is at least mostly working now.

I have one more little question, then I'll be out of your hair (for a little while at least ) How do I set a wildcard for a URL? For example, in the following code

Code:
' WebBrowser1.Url Is "http://www.writely.com/" Then
        WebBrowser1.Navigate(bstrUrl)
        Else : System.Diagnostics.Process.Start(bstrUrl)
        End If

How would I get it so that http://writely.com/* opens the URL in WebBrowser1, while everything else still opens in the default browser?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #23 (permalink)  
Old 08-29-2006, 12:04 PM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 11
brackett is on a distinguished road
Default

You could use a RegEx for that - but for your particular scenario, you could just do:
Code:
   If Not String.IsNullOrEmpty(bstrUrl) AndAlso bstrUrl.IndexOf("writeley.com") >= 0 Then
       ' String contains writeley.com
   Else
       ' String does not contain writeley.com
   End If
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Object IO Stream Data Loss Possible? Any solution, pls? reachpradeep Java Help 0 03-05-2007 03:02 PM
object in session.... "<logic:present>" with JSTL? reachpradeep Java Help 0 03-04-2007 09:46 AM
Regarding Request Object reachpradeep Java Help 0 03-03-2007 10:46 AM
Object is Null Lop C# Programming 2 09-21-2006 12:25 PM
Check object for null Lop C# Programming 3 07-18-2006 06:56 AM


All times are GMT -5. The time now is 04:25 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads