HTML Script to Visual Basic Converter RRS feed

  • Question

  • I'm a newbie to Programming, but i found this HTML Script and i want to convert to VB2010 Code.

    <form id="key-gen">
    <input id="name" type="text" placeholder="Name">
    <button id="generate" type="submit">Generate</button>
    <h2>Registration Code</h2>
    <div id="code"></div>
    function shift8b(name) {
    return name.replace(/[8B]/, function (match) {
    return match == '8' ? 'B' : '8';
    function getCode(name) {
    var professionals_code = [0x10051981, 0x4011995, 0x2061997, 0x12091999, 0x16062004, 0x21042002, 0x13062004, 0x9112005, 0x24112005],
    codes = [],
    length = name.length,
    v = length,
    code = 0x47694C; // Magic String Standard Version
    name = name.toUpperCase();
    for (var i = 0; i < length; i++) {
    if ((i % 14) == 0) {
    v = 39;
    code += v * name.charCodeAt(i);
    v *= ((i + 3) % 14) ? 3 : 7;
    // standard registration code
    // codes.push(shift8b(code.toString(16).toUpperCase()));
    for (var i = 0; i < professionals_code.length; i++) {
    // Magic String Professional Version
    (code + professionals_code[i]).toString(16).toUpperCase()
    return codes;
    function onClickKeyGen(e) {
    var nameNode = document.getElementById('name'),
    codeNode = document.getElementById('code');
    codeNode.innerHTML = getCode(nameNode.value).join('<br>');
    // for IE
    if (!e) return false;
    var keyGenNode = document.getElementById('key-gen');
    if (document.addEventListener) {
    keyGenNode.addEventListener('submit', onClickKeyGen);
    } else {
    // for IE
    keyGenNode.onsubmit = onClickKeyGen;

    But i don't find any good converters to do it

    Monday, December 24, 2018 10:03 AM

All replies

  • Hello,

    First off I would recommend indicating exactly (more details are best) what you are trying to do which means describing what the HTML does (too me it appears to generate a code when submitting the form). 

    Being a newbie this task may very well be past your skill level to simply code yourself but you will never learn until you take a stab at it and when stuck come back here and ask for assistance.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, December 24, 2018 10:55 AM