c# WebBrowser not showing info inside -
(first of all, sorry english) well, have problem in 1 client message try show doesn't appear in component showing component empty, happends in 1 client 1000. started fail since yesterday, client has windows 7, don't know ie version
in case, i'm doing newvalue introduce words bold.
i can't reproduce error on machine, knows reason (windows update, ie version, text inside,...) make fail or show blank??
webbroser inside form, use messagebox, can print colors or else figure in message.
private void setwebbrowsertext(string newvalue) { try { if (this.webbrowser1.document == null) this.webbrowser1.navigate("about:blank"); if (!string.isnullorempty(newvalue)) newvalue = string.concat("<div><font color=\"#000000\" size=\"2\" face=\"verdana\">", newvalue.replace("\n", "<br>"), "</font></div>"); webbrowser1.document.write(newvalue); } catch { } }
vb.net:
public sub showmessage(byval htmlmsg string) webbrowser1.navigate("") while webbrowser1.readystate <> webbrowserreadystate.complete application.doevents() system.threading.thread.sleep(1) loop webbrowser1.document.body.innerhtml = htmlmsg end sub
c#:
public void showmessage(string htmlmsg) { webbrowser1.navigate(""); while (webbrowser1.readystate != webbrowserreadystate.complete) { application.doevents(); system.threading.thread.sleep(1); } webbrowser1.document.body.innerhtml = htmlmsg; }
example:
showmessage("<h1>msg</h1> <h2 style='color:red'>red msg</h2>")
Comments
Post a Comment