Set predefine form value (webbrowser control)

Posted by Khou on Stack Overflow See other posts from Stack Overflow or by Khou
Published on 2010-03-17T03:27:45Z Indexed on 2010/03/17 3:31 UTC
Read the original article Hit count: 462

Filed under:
|
|
|

Hi

I want to load my windows form: web browser thats using the webbrowser control, It would load a web page, and load my defination and search for elements that has been define, it will then assign the default values and these values can not be changed by the end user.

Example If my application finds "FirstName" it would always assign the value "John" If my application finds "LastName" it would always assign the value "Smith" (these values should not be changed by the end user).

Here's how to do it in HTML/JAVASCRIPT, but how do i do this in a windows form?

HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>page title</title>
    <script script type="text/javascript" src="demo1.js"></script>
</head>
<body onload="def(document.someform, 'name', 'my default name value');">

    <h2 style="color: #8e9182">test form title</h2>
    <form name="someform" id="someform_frm" action="#"> 
    <table cellspacing="1"> 
        <tr><td><label for="name">NameX: </label></td><td><input type="text" size="30" maxlength="155" name="name" onchange="def(document.someform, 'name', 'my default name value');"></td></tr>
        <tr><td><label for="name2">NameY: </label></td><td><input type="text" size="30" maxlength="155" name="name2"></td></tr>
        <tr><td colspan="2"><input type="button" name="submit" value="Submit" onclick="showFormData(this.form);" ></td></table>
    </form>

</body>
</html> 

JAVASCRIPT

function def(oForm, element_name, def_txt) {

oForm.elements[element_name].value = def_txt;


} 

© Stack Overflow or respective owner

Related posts about c#

Related posts about form