Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 4.18 KB

Vb.md

File metadata and controls

54 lines (35 loc) · 4.18 KB

VB (Language.Vb)

Visual Basic has been implemented with the VB CodeDom.

Implementation / Compiler

Completeness

  • Syntax highlighting
  • Compilation
  • Execution
  • Console ouput
  • Return values
  • Diagnostics
  • Errors

Example code | Projects

About

Every VB fiddle code has to be written like the following:

Public Module [MName]
    Public [Function or Sub]
	    ' ...
    End [Function or Sub]
End Module

Where [MName] is any Module name (eg: Main), and [Function or Sub] can be either a returning function (Function) or a void function (Sub). The first found method will be the entry point.

Globals

You can use the following Globals/Variables inside your code:

  • Random (object, .NET System.Random, msdn): Create random numbers with Random.Next(..)

  • Console (object, .NET System.IO.StringWriter, msdn): Write to Console with Console.WriteLine(string) or Console.Write(string)

  • CurrentThread (object, .NET System.Threading.Thread, msdn): The thread this got initialized on (mostly UI Thread), can be used to access all properties or functions from a System.Threading.Thread.

  • Editor (object, Fiddle Fiddle.UI.Editor (from System.Windows.Window, msdn)): Fiddle's Editor window, can be used to access all UIElements, properties, public functions or functions derived from System.Windows.Window. (Editor XAML code, Editor source code)

  • App (object, .NET System.Windows.Application, msdn): Fiddle's calling Application/App, can be used to access all properties or functions derived from System.Windows.Application)

  • RunUi(Action) (function, void Invoke(Action), declaration): A function with an anonymous function or Action as a parameter to execute code on the UI Thread. This is required for getting/setting properties or calling functions from Editor or App because those are not thread safe. Example:

RunUi(Sub() Editor.Hide());

Properties

  • string[] imports: A list of assemblies to be referenced and imported by the script. If empty, Fiddle does not automatically import anything like in C#, the default imports for VB CodeDom will be used.