Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ~
how are you.. ?

I'm a new programmer..

I have a little problem that I can't solve it.. I try to ask and I search all the web but without any result..

My problem is that I made a web browser program in vb.net
and I want to make a ToolStripMenuItem that when I click it copy the link location to clipboard and so I can past it into combobox like url for that location..

I wrote this code

*
Private oElement As HtmlElement


VB
Private Sub ToolStripMenuItem13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem13.Click
     Clipboard.SetText(oElement.GetAttribute("HREF"))
 End Sub




but it didn't work.. show me error..

please Help me ~
Posted
Comments
[no name] 8-Nov-11 12:53pm    
And what was the error?

Professional developers learn to debug and can give more information than "it didn't work"
nawarfattah 8-Nov-11 13:52pm    
I'm sorry Mark.. I'm new at programming, these is my first year, I love programs so much,,

this problem

https://lh3.googleusercontent.com/-oyscGyaGqdk/Trl4mjTzP-I/AAAAAAAAAQ8/psG_9vn-Eew/s598/Capture.JPG

https://lh5.googleusercontent.com/-fkhmtB1wwrA/Trl4pdam3AI/AAAAAAAAARE/fD2irFn8jp8/s517/Capture1.JPG

I really want to make it..
nawarfattah 9-Nov-11 14:18pm    
Help plz..

OK so you have a null reference, which means that you are trying to use an object reference that has not been initialised. Unfortunately your picture has the dialog obscuring the offending line of code, but, at a guess it is in the line:
C#
Clipboard.SetText(oElement.GetAttribute("HREF"))

So, where does oElement come from and what does it point to?
 
Share this answer
 
Yep.. that's true.. oElement come from here

VB
Public Class frmBrowser

    Public WithEvents oDoc As HtmlDocument
    Private oElement As HtmlElement


and it point to HtmlElement.
you know, like I want to tell him that you have to copy the link that the pointer is on it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900