problem with WebBrowser

Discussion in 'Questions (Windows Mobile)' started by Byak@, Jul 26, 2009.

  1. Byak@

    Byak@ Active Member Licensed User

    in my app i want use webbrowser as Option's dialog.i think it is very сomfortably.
    i'm create a html document with textbox and checkbox.and i want get documenttext (when i fill textbox and check checbox) and then parse it.
    but DocumentText in WebBrowserEx return to me old documenttext that I create at the beginning! (without changes)

    i'm found in msdn new(for me) parametr and sample but i don't understand how use it in basic WebBrowser.Document - ???????? (System.Windows.Forms)

    example
     

    Attached Files:

    • ex.zip
      File size:
      11.8 KB
      Views:
      49
  2. ExcludeReality

    ExcludeReality Active Member Licensed User

    It seems DocumentText returns the source code of the page.
    You should use JavaScript to get properties and values of the HTML forms.

    Example:
    Code:
    <html>
    <head>
    <script 
    type="text/javascript">
    function getValue()
    {
    alert(document.getElementById(
    "text1").value);
    alert(document.getElementById(
    "check1").checked);
    }
    </script>
    </head>
    <body>

    <form>
    <input type="text" id="text1" value="Type me" />
    <input type="checkbox" id="check1" value="Check me" checked/>
    <input type="button" id="button1" onclick="getValue()" value="Show value" />
    </form>

    </body>
    </html>
    "Document.getElementById("text1").value" gets the current value of the text box.
    "Document.getElementById("check1").checked" gets the current state of the checkbox
    Try to do some additional research
     
    Last edited: Jul 27, 2009
  3. Byak@

    Byak@ Active Member Licensed User

    ooo,big thanks!but how can i get this values to my program?and i not want msgboxes...help please
     
  4. ExcludeReality

    ExcludeReality Active Member Licensed User

    I think the only way to do this is to write the values to a file, and then read the file from your application.

    For example:
    Code:
    <html>
    <head>
    <script 
    type="text/javascript">
    function getValue()
    {
    var fso = new ActiveXObject(
    "Scripting.FileSystemObject");
    var FileObject = fso.OpenTextFile(
    "Test.txt"8true,0);
    FileObject.write(document.getElementById(
    "text1").value)
    FileObject.close()
    }
    </script>
    </head>
    <body>

    <form>
    <input type="text" id="text1" value="Type me" />
    <input type="checkbox" id="check1" value="Check me" checked/>
    <input type="button" id="button1" onclick="getValue()" value="Show value" />
    </form>

    </body>
    </html>
    This will write the text in the textbox to the file Test.txt.
    Read the file with your application to get the values.

    NOTE: This example will only work with Internet Explorer, Since it uses an ActiveX object.
    I'm not sure if Agrahams WebBrowser control allows ActiveX, but you should give it a shot
     
  5. Cableguy

    Cableguy Expert Licensed User

    That is a correct assumption.

    This is already implemented in the WebBrowserEX Dll, in wich it is possible to eithet get/set the value of a give control, either by name or by ID...
    This is Not implemented im my WebBrowserEX, as I only added the "I need this" features in it, and no user ever asked for it...
    Still it would be far more easy to simply scout the documenttext, for the given control changes, than to include a get method for every control type.
     
  6. ExcludeReality

    ExcludeReality Active Member Licensed User

    Sorry Cableguy, I thaught Agraham made get WebBrowser library.
    I must have confused it with the htmlPanel.

    I'm not sure I follow. The way I see it Javascript is the only way to get properties
     
  7. agraham

    agraham Expert Licensed User

    I did! WebBrowser runs on both device and desktop and as such offers strictly only the capabilities supported on the device.

    Cableguy took the WebBrowser source code and added some desktop only capabilities to produce WebBrowserEx that will only run on the desktop.
     
  8. Byak@

    Byak@ Active Member Licensed User

    i'm try but not happend...
    Please make though something with it
    webbrowser very convenient control and to use it as the interface of the program it would be healthy!
     
    Last edited: Jul 29, 2009
  9. ExcludeReality

    ExcludeReality Active Member Licensed User

    :confused: This is so confusing. Why don't you just combine all the WebBrowsers into one super-browser library?
    I'm waiting for it :)
     
  10. agraham

    agraham Expert Licensed User

    Because it is just not possible! If you want a WebBrowser to run on the device then the WebBrowser library does all that a device supports and will run on the desktop as a bonus.

    If you want the extra capabilities that a desktop can offer then WebBrowserEx offers some of them but because those capabilitie are not present on the device WebBrowserEx will not run on the device. Period!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice