Arkiv for december 2008

VBScript – Choosing an editor

This will be my first article about coding in VBScript. I have not done it before, so I will on my blog write down my problems, the solutions to them and my thoughts about VBScript.

This series of articles will be written in English, so please forgive any misspelling etc.

Choosing an editor
Since I have no experience in coding in VBScript, I neither have any idea about which editor is good or bad. I made a simple search on Google with the keywords “vbs editor” and choose the first (and hopefully the best) editor on the result list.

The editor I found is called VbsEdit and it is an award-winning editor. The editor is still begin updated – I downloaded the last version released December 19, 2008. The version is 3.4.1.

You can download the file by clicking here (to download from my mirror, click here). If you want to read more about VbsEdit you can go to http://www.vbsedit.com/.

The editor should containt a debugger, so I can test my script directly from the program, syntax highlighting, line numbers, code snippets, code samples, displaying of methods etc. when writing the code and other cool stuff like that.

The editor is a evaluation version, but this version never expires, so you do not need to register the product. However if you feel like doing it, it costs 49,00 USD for a single-user lifetime license, so the editor is not very expensive. I have desided to test the editor first to see if its the right editor for me.

As I said before this is the first article in a series of articles about VBScript. I will later on write about my first thoughts, problems and such when starting to code in VBS.

Until that happens – have a nice time !

Problems installing software on Microsoft Windows Vista SP1

This article is written in English – please excuse it, my English is not the best!

I have several times had the problem when installing software on my Microsoft Windows Vista SP1 (Ultimate edition) that the installation errors with a “Error 1722″. The error 1722 is a “Windows Installer Package”-error.

Sometimes the error can be solved installing the Microsoft Visual C++ 2005 SP1 Redistributable Package, which can be found here for 32-bit Windows.

However after installing the above I still got the problem with some software (Microsoft Dynamics NAV / Navision being one of them).

I therefore used the command “Run as Administrator” when I started the installer (you can find the command by right-clicking the file). But the “Run as Administrator” is not shown when right-clicking a .msi-file.

I have a little work-around for that – the Command Prompt:

  1. Go to Start -> All Programs -> Accessories.
     
  2. Find the short-cut for Command Prompt and right-click it. Choose “Run as Administrator”.
     
  3. The Command Prompt opens. Now navigate to the folder where your .msi-file is placed (you need to know the standard DOS-command ‘CD’ – I will in short explain it further down).
     
  4. Now run the .msi-file through the Command Prompt. You can do that by typing the name of the .msi-file and push “Enter”.
     
  5. Run through the installation and hope it works – it does for me! :-)

The DOS-command CD – very very very short!

Typing “CD ..” (without the quotes) will navigate you to the previous folder.

Typing “CD foldername” (without the quotes) will navigate you to the folder “foldername” that exists at your current destination.

Dynamics NAV: Custom text boxes on a Request Form in a Dataport

This article is in English because Microsoft Dynamics NAV (better known as Navision) is a world-wide product. Please excuse my English – it is not the best!

In this article I will explain how you can put custom text boxes on the Request Form in a Dataport-object.
As far as I know this solution works for Microsoft Dynamics NAV 5.0 SP1 and all earlier versions. I have not tested this on Dynamics NAV 2009, but my best guess is that this work-around works for the Classic Client in Dynamics NAV 2009 too.

The problem with the Request Form and custom text boxes is that when you put your custom text boxes on the Request Form, the normal text box for choosing what file to import/export will disapear.

To solve this problem you have to do the following steps:

  1. Create a new global variable - I will call the variable “VarFilename” in my example.
     
  2. Insert a new text box (don’t forget a label for the text box) from the Toolbox.
     
  3. Set the ID of the new text box to ’1′.
     
  4. Put the following code in the “OnAssistEdit()”-function of the new text box:
    CurrDataport.FILENAME := VarFilename;

Now run the Dataport and see that is works.

To follow NAV-guidelines remember to give the label, linked to the text box, the correct caption as if it was a standard Dataport, and remember to place the text box at the top of the Request Form.

Good luck with the coding! ;-)