Ver Mensaje Individual
  #6 (permalink)  
Antiguo 14/04/2009, 13:56
emma93
 
Fecha de Ingreso: abril-2008
Ubicación: Córdoba
Mensajes: 103
Antigüedad: 16 años
Puntos: 4
Respuesta: Colorear en WebBrowser. | VB .NET

Mirá el error que me da:

Cita:
No se controló System.InvalidCastException
Message="No se puede convertir el objeto COM del tipo 'mshtml.HTMLDocumentClass' al tipo de clase 'System.Windows.Forms.HtmlDocument'. Las instancias de tipos que representan componentes COM no pueden convertirse en tipos que no representan componentes COM; sin embargo, pueden convertirse en interfaces siempre que el componente COM subyacente admita llamadas QueryInterface para el IID de la interfaz."
Source="WindowsApplication1"
StackTrace:
en WindowsApplication1.Form1.Button1_Click(Object sender, EventArgs e) en G:\Users\Administrador\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb:línea 8
en System.Windows.Forms.Control.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ButtonBase.WndProc(Message& m)
en System.Windows.Forms.Button.WndProc(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.Run(ApplicationCo ntext context)
en Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
en Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
en Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
en WindowsApplication1.My.MyApplication.Main(String[] Args) en 17d14f5c-a337-4978-8281-53493378c1071.vb:línea 81
en System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
en Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
en System.Threading.ThreadHelper.ThreadStart_Context( Object state)
en System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
en System.Threading.ThreadHelper.ThreadStart()
InnerException:
Mi código es:

Cita:
Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://www.google.com.ar")
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As HtmlDocument = WebBrowser1.Document.DomDocument
Dim html As System.Text.StringBuilder = New System.Text.StringBuilder
Dim palabra As String = "Imágenes"
x.ToString.Replace(palabra, "*")
x.Body.InnerHtml = html.ToString
End Sub
End Class
Ya me esta cansando esto ¬¬