Book a Demo

Author Topic: Visual Basic, some keywords don't work  (Read 5135 times)

deldan

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Visual Basic, some keywords don't work
« on: February 13, 2015, 10:24:39 pm »
Hello,

I started VB scripting in EA 10. I have noticed that some VB keywords don't works e.g.:

Optional, as (in sub and function parameters types)

Code: [Select]
Function Works(package)
   Works = ""
End Function

Code: [Select]
Function Doesnt_Work_1(package as String)
   Doesnt_Work_1= ""
End Function

Code: [Select]
Function Doesnt_Work_2(Optional package = 100)
   Doesnt_Work_2= ""
End Function


Examples with prefix "Doesnt_Work" doesn't work in EA. I know they are correct because I have check them in Visual Studio.

It means that EA doesn't support fully VB or maybe I have to change some configuration?
« Last Edit: February 13, 2015, 10:46:54 pm by deldan »

EXploringEA

  • EA User
  • **
  • Posts: 172
  • Karma: +8/-0
    • View Profile
Re: Visual Basic, some keywords don't work
« Reply #1 on: February 14, 2015, 12:09:01 am »
The scripting engine supports VBScript (plus JScript and JavaScript) which is not the same as Visual Basic - it's a different language that looks similar but has some different syntax, no typing, plus other limitations if you are used to VB but still useful.

Suggest you google a tutorial on VBScript to see examples and differences

Hope that helps explain why you are having issue.
EXploringEA - information, utilities and addins

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Visual Basic, some keywords don't work
« Reply #2 on: February 14, 2015, 12:51:13 am »
What make it difficult is that in EA you can write

Code: [Select]
dim myElement as EA.Elementand it will work. Even better, it allows you to use intellisense for attributes and operations.

When you try that in vanilla VBScript however you get an error.

Geert

EXploringEA

  • EA User
  • **
  • Posts: 172
  • Karma: +8/-0
    • View Profile
Re: Visual Basic, some keywords don't work
« Reply #3 on: February 14, 2015, 03:21:21 am »
And it can be very frustrating making silly mistakes :'(
EXploringEA - information, utilities and addins