LesF 15 Well aged software developer

When I last made an installer for a VB6 application I used the nullsoft installation creator, which is very flexible and useful. I believe you can include a DLL with methods to be executed as part of the installation process, which could then be used to verify license keys and store some authentication data in the registry or elsewhere.

As for database access, yes you can do that still, you need to reference ADODB, which you may need to install if it is not present, and you can connect to all sorts of databases. At work I still support some old VB6 code which uses Sql Server for both SQL queries and stored procedure calls.

rproffitt commented: ADODB looks to be dead in VB6 here on W10. Maybe other versions are dead too. +15
LesF 15 Well aged software developer

If you want to use the system date and time you can use 'Now', as in:

Dim dtmNow As Date
dtmNow = DateValue(Now)

I can't remember if dtmNow.Value can be assigned directly to a OleDbType.Date field type, but you can try it and see.

LesF 15 Well aged software developer

There are free versions of Visual Studio, providing C#, VB.Net and a bunch of other languages which can now be used with .Net, including Python (search for Visual Studio Express).
Your decision should depend on your requirements tho; are you doing web pages, or do you want client based applications, if so, do you want a user interface which runs on a specific OS or do you want it to run on many.
I have been reading about QT5 and their QML markup language for UI, and this is looking quite attractive, as well as being multi-platform. However I have not started to do any coding in it yet so I cannot really judge. Give it a try if you were ever fond of C or C++.
Personally I would stay well away from the old VB6, it had its day but is not the nicest way to write code any more. I'm not a hater, I used it extensively for quite some time, but newer languages let you do more with less code.

LesF 15 Well aged software developer

I changed the language from coffeescript to JavaScript and this works, tho I left out the image retrieval part. Maybe this will help you work out the coffescript version anyway:

$.ajax({
    url: 'http://api.wunderground.com/api/36b799dc821d5836/conditions/q/UK/London.json',
    dataType: 'jsonp',
    data: '?',
    success: function(weatherData){
        if (weatherData["current_observation"] != null
           && typeof weatherData["current_observation"] === 'object')
           DisplayWeather(weatherData["current_observation"]);
    }
});
function DisplayWeather(obsData)
{
    // alert("Observation country: " + obsData.observation_location.country);
    var tmpC = parseInt(obsData.temp_c);
    $(".currenttemp").html(obsData.temp_c);
    $(".currentcondition").html(obsData.weather);

    if (tmpC < 16)
        $(".weatherModule").css('background','#0000ff');
    else if (tmpC < 26)
        $(".weatherModule").css('background','#00ff00');
    else
        $(".weatherModule").css('background','#ff0000');
}
LesF 15 Well aged software developer

Possibly remove the 'display:none' from your box class. You don't need those 3 boxes, you can just use one div and use jquery methods addClass and removeClass to change it's color.
You have a class named currentConditions, but your code uses currentcondition.
Sorry, apart from that I can't get much further, have you tried getting it to work in JavaScript instead of coffeescript?

LesF 15 Well aged software developer

Can you combine the 10 to 20 GET requests into 1? If you can pass a list if ids and return for example a dictionary of results, it can often be much better to retrieve a large chunk of data in one go rather than adding the overhead of a call for each small piece of data.

LesF 15 Well aged software developer

Shouldn't line 10 be after line 30? You are assigning the value of the var before you create it.

var phrase = wordListOne[rand1] + " " + wordListTwo[rand2] + " " + wordListThree[rand3];
_("phrase").innerHTML =  phrase;

For that matter, you don't need the go-between var phrase anyway.

LesF 15 Well aged software developer

I think you should put the content data into the 'data' parameter in the ajax call, instead of adding it to the URL, such as:

url: "submit.php",
data: "{'content':'" + content + "'}",

but it gets a bit tricky with the formatting of the value for the data parameter; the value should be a serialized JSON string, and the contents of a textarea can of course include quote characters etc. I sometimes use a stringify function to serialize an array of data to be submitted, and do something like:

var myParams = {param1: value1, param2: value2};
$.ajax({
  type: 'GET',
  url: 'submit.php',
  contentType: 'application/json',
  data: stringify(myParams),
  dataType: 'json',
  etc...

Depending on the version of jQuery or whatever libraries you are using, or versions of browser you are targetting, the stringify function or other JSON serialisation methods may be available already.

LesF 15 Well aged software developer

I'm a bit rusty on the PHP but I think that is correct, the value of a 'hidden' input field should be handled much like the value of a 'text' input.

LesF 15 Well aged software developer

Try making the alerts:
alert(document.getElementById('hidimgSrcOrig').value);

LesF 15 Well aged software developer

I don't think you can position them. I remember you can create your own form and use ShowDialog, then configure it to be centered on parent.

LesF 15 Well aged software developer

Not sure about the [] character in your id and name values, is that causing them to fail to be found? I always stick with the basic rule for ids, which I think is:
[A-Za-z][-A-Za-z0-9_:.]*

LesF 15 Well aged software developer

If you want to have a value posted back in the form data you can use a hidden control:

<input type='hidden' id='hidImageName' name='hidImageName' />

then update it's value when you update the image:

function SetImage()
{
  document.imgSrcOrig.src = myImgSrc + myImg[i] + myImgEnd;
  document.getElementById('hidImageName').value = myImg[i];
}
function prev()
{
  if (i > 0) i--;
  SetImage();
}
function next()
{
  if (i < (myImg.length -1)) i++;
  SetImage();
}

Then your postback data will incude a value named 'hidImageName'.

LesF 15 Well aged software developer

You may need to give a more detailed explanation of what you are trying to do, but I expect you need to save your data someplace from your web form, such as a database or a text file, then have you web page load the data using the appropriate retrieval method.
Is your web page being served by a web server or is it a static page you just open in the browser?

LesF 15 Well aged software developer

Did you solve your row deletion? As a quick memory test I threw this together:

<table border='1' id='TheTable'>
    <thead><th>..</th><th>Article</th></thead>
</table>
<input type='button' onclick='AddRow()' value='Add Article' />
&nbsp;
<input type='button' onclick='DeleteSelected()' value='Delete Selected' />

and script:

articleCount = 0;
function AddRow()
{
    var tb = document.getElementById('TheTable');
    var tbCount = tb.rows.length;
    var row = tb.insertRow(tbCount);
    var td1 = row.insertCell(0);
    var chk = document.createElement('input');

    articleCount++;
    chk.type = 'checkbox';
    chk.id = 'check_' + articleCount;
    td1.appendChild(chk);
    row.appendChild(td1);
    var td2 = row.insertCell(1);
    var spn = document.createElement('span');
    spn.innerHTML = "Article-" + articleCount;
    td2.appendChild(spn);
}
function DeleteSelected()
{
    var tb = document.getElementById('TheTable');
    var tbCount = tb.rows.length;
    for(var idx = tbCount -1; idx >= 0; idx--)
    {
        var row = tb.rows[idx];
        var chk = row.cells[0].childNodes[0];
        if (chk != null && chk.checked)
            tb.deleteRow(idx);
    }
}
LesF 15 Well aged software developer

Is that HTML a complete copy of the code you are using?
You have a body end tag instead of a body opening tag, and I cannot see the form opening tag, only the form end tag.
If you change the button from a 'submit' to a 'button', just for testing, does it trigger your event handler?
The 'submit' works on a form, causing a submit to the server, so not having the form opening tag will be an issue.

LesF 15 Well aged software developer

Does your browser have developer tools or let you see the javascript console? On chrome the console lists various errors when your page loads;

Uncaught ReferenceError: imageArray is not defined 
Uncaught TypeError: Cannot read property 'image_item' of undefined 

It looks like imageArray is not declared with var.
Your function imageItem might need some changes to make it return the expected object type

LesF 15 Well aged software developer

Maybe add an id attribute to slideImg, not sure of document[place] is going to locate an element by the name attribute. eg:
<img id="slideImg" name="slideImg" src="images/01.jpg" width="800" />

[edit] sorry, ignore that. The name attribute is ok.
Tho there is a spelling error on your 'next' link; clearTimeout(tmierID)

LesF 15 Well aged software developer

Read this interview...
Click Here

There may be some useful tips there.

LesF 15 Well aged software developer

A quick search on "install vb6 on windows7" will get you a set of instructions to get that installation to work, some suggest you need to turn off UAC during the installation to get some of the files installed in system folders correctly, can't remember the other complications. I may have some info at work still, but I use VB6 a lot on my Win7 64bit system.

Once installed, you need to run VB6 in XP compatability mode - you need to disable Visual Themes and Desktop Composition options, to get the IDE to display properly.

Also, you may want to search for "scroll wheel fix for vb6" to get an add-on which makes the IDE respond to the mouse wheel, its horrid without it.

LesF 15 Well aged software developer

I think you want to use the vbmodal parameter with the form.Show statement.
A modal form has focus and does not let you interact with other forms in the application until it has been closed.

form1.show

opens a non-modal form, you can set focus to other forms in the app.

form1.show vbmodal

opens a modal form, must be closed before you can access other forms.

LesF 15 Well aged software developer

You remove the SelectedItem from the list, so I assume selection moves to the next item in the list.
Copy the value from the list item into a string variable before removing it from the list. Use the string variable in the next method call.

LesF 15 Well aged software developer

It sounds like you need to spend a little time studying some introductory material, such as this section on MSDN:

Creating Windows Forms

In brief; a form is a definition of a class, you create an instance variable of that class type in your program, then you can display that form instance as either a modal or non-modal form. e.g.
Form2 myForm = new Form2();
then, myForm.Show() will load a non-modal form, while myForm.ShowDialog() will create a modal form which must be closed before you can set focus back to the form which created it. Refer to the link above for some user-friendly examples.

As for tabbed forms, I'm not sure what your required layout is, but the commonest approach is called MDI Forms, where you have a master or parent form and load one or more child forms within the parent. Various tricks can be used to provide navigation between the child forms, such as tab-bars and tree-views etc. This may be a useful guide:

How to create MDI Child Forms

And finally, text from a textbox... A textbox control is an object, which has a number of attributes, the Text attribute references the current text value, so for instance you could use:

textBox1.Text = "asdf";
or
string theText = textBox1.Text;

LesF 15 Well aged software developer

If you have IE8 you can debug the javascript using Tools/Developer Tools, I think that was installed by default anyway. You can step thru your code line by line and set watches on the variables.

LesF 15 Well aged software developer
var CurrentUrl = window.top.frames['frameName'].location.href;

replace 'frameName' with the correct name - assuming you have assigned a name attribute to the frame element.

LesF 15 Well aged software developer

Try

elementWhatever.style.display = "none";

and

elementWhatever.style.display = "block";

to hide and show the element you are trying to modify.

LesF 15 Well aged software developer

how do you connect to a Excel database using c#

You can use one of the Microsoft database connectors, if you have it installed, some may be provided by installing Office or other products. Your DSN string will be something like:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";

at least, if you are using the Jet OLEDB type connection. There are others, see http://www.connectionstrings.com/ for better informed examples.

This will allow you to access a table within a worksheet, the HDR=Yes tells it to expect a row of column names at the top, you have to handle the data types yourself, I think. I have working code examples at work someplace but nothing available here.

LesF 15 Well aged software developer

I would try to set the SelectedIndex value on the select element, as in...

HtmlElement theList = webBrowser1.Document.GetElementsByTagName("select")[0];
if (theList != null)
{
   theList.SetAttribute("SelectedIndex", "0");
}

Remembering that the options in the select element are zero-based, the first option has an index of zero.

--
Les.