Current Help System: PC-DMIS BASIC (View Core Help)

## Text Statement

Text Starting X position, Starting Y position, Width, Height, Label

Creates a text field for titles and labels.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main ()

Begin Dialog DialogName1 60, 60, 160, 70, "ASC - Hello"

TEXT 10, 10, 28, 12, "Name:"

TEXTBOX 42, 10, 108, 12, .nameStr

TEXTBOX 42, 24, 108, 12, .descStr

CHECKBOX 42, 38, 48, 12, "&CHECKME", .checkInt

OKBUTTON 42, 54, 40, 12

End Dialog

Dim Dlg1 As DialogName1

Dialog Dlg1

MsgBox Dlg1.nameStr

MsgBox Dlg1.descStr

MsgBox Dlg1.checkInt

End Sub

### TextBox Statement

Current Help System: PC-DMIS BASIC (View Core Help)

## TextBox Statement

TextBox Starting X position, Starting Y position, Width, Height, Default String

Creates a Text Box for typing in numbers and text

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main ()

Begin Dialog DialogName1 60, 60, 160, 70, "ASC - Hello"

TEXT 10, 10, 28, 12, "Name:"

TEXTBOX 42, 10, 108, 12, .nameStr

TEXTBOX 42, 24, 108, 12, .descStr

CHECKBOX 42, 38, 48, 12, "&CHECKME", .checkInt

OKBUTTON 42, 54, 40, 12

End Dialog

Dim Dlg1 As DialogName1

Dialog Dlg1

MsgBox Dlg1.nameStr

MsgBox Dlg1.descStr

MsgBox Dlg1.checkInt

End Sub

### Time Function

Current Help System: PC-DMIS BASIC (View Core Help)

## Time Function

Time[()]

Returns the current system time.

Related topics: To set the time use the TIME$ statement.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main

x = Time$(Now)

Print x

End Sub

### Timer Event

Current Help System: PC-DMIS BASIC (View Core Help)

## Timer Event

Timer

Timer Event is used to track elapsed time or can be display as a stopwatch in a dialog. The timers value is the number of seconds from midnight.

Related topics: DateSerial, DateValue, Hour, Minute, Now, Second, TimeValue.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main

Dim TS As Single

Dim TE As Single

Dim TEL As Single

TS = Timer

MsgBox "Starting Timer"

TE = Timer

TT = TE - TS

Print TT

End Sub

### TimeSerial - Function

Current Help System: PC-DMIS BASIC (View Core Help)

## TimeSerial - Function

TimeSerial ( hour, minute, second )

Returns the time serial for the supplied parameters hour, minute, second.

Related topics: DateSerial, DateValue, Hour, Minute, Now, Second, TimeValue.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main

Dim MTime

MTime = TimeSerial(12, 25, 27)

Print MTime

End Sub

### TimeValue - Function

Current Help System: PC-DMIS BASIC (View Core Help)

## TimeValue - Function

TimeValue ( TimeString )

Returns a double precision serial number based of the supplied string parameter.

Midnight = TimeValue(“23:59:59”)

Related topics: DateSerial, DateValue, Hour, Minute, Now, Second, TimeSerial.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main

Dim MTime

MTime = TimeValue("12:25:27 PM")

Print MTime

End Sub

### Trim, LTrim, RTrim Functions

Current Help System: PC-DMIS BASIC (View Core Help)

## Trim, LTrim, RTrim Functions

[L| R] Trim (String )

- Ltrim, Rtrim and Trim all Return a copy of a string with leading, trailing or both leading and trailing spaces removed.

- Ltrim, Rtrim and Trim all return a string

- Ltrim removes leading spaces.

- Rtrim removes trailing spaces.

- Trim removes leading and trailing spaces.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

' This example uses the LTrim and RTrim functions to strip leading and

' trailing spaces, respectively, from a string variable. It

' uses the Trim function alone to strip both types of spaces.

' LCase and UCase are also shown in this example as well as the use

' of nested function calls

Sub Main

MyString = " <-Trim-> " ' Initialize string.

TrimString = LTrim(MyString) ' TrimString = "<-Trim-> ".

MsgBox "|" & TrimString & "|"

TrimString = LCase(RTrim(MyString)) ' TrimString = " <-trim->".

MsgBox "|" & TrimString & "|"

TrimString = LTrim(RTrim(MyString)) ' TrimString = "<-Trim->".

MsgBox "|" & TrimString & "|"

' Using the Trim function alone achieves the same result.

TrimString = UCase(Trim(MyString)) ' TrimString = "<-TRIM->".

MsgBox "|" & TrimString & "|"

End Sub

### Type Statement

Current Help System: PC-DMIS BASIC (View Core Help)

## Type Statement

Type usertype elementname As typename

[ elementname As typename]

. . .

End Type

Defines a user-defined data type containing one or more elements.

The Type statement has these parts:

Part | Description
Type | Marks the beginning of a user-defined type.
usertype | Name of a user-defined data type. It follows standard variable naming conventions.
elementname | Name of an element of the user-defined data type. It follows standard variable-naming conventions.
subscripts | Dimensions of an array element. You can declare multiple dimensions. (not currently implemented)
typename | One of these data types: Integer, Long, Single, Double, String (for variable-length strings), String * length (for fixed-length strings), Variant, or another user-defined type. The argument typename can't be an object type. End Type Marks the end of a user-defined type.

Once you have declared a user-defined type using the Type statement, you can declare a variable of that type anywhere in your script. Use Dim or Static to declare a variable of a user-defined type. Line numbers and line labels aren't allowed in Type...End Type blocks.

User-defined types are often used with data records because data records frequently consist of a number of related elements of different data types. Arrays cannot be an element of a user defined type in Enable.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

' This sample shows some of the features of user defined types

Type type1

a As Integer

d As Double

s As String

End Type

Type type2

a As String

o As type1

End Type

Type type3

b As Integer

c As type2

End Type

Dim type2a As type2

Dim type2b As type2

Dim type1a As type1

Dim type3a as type3

Sub Form_Click ()

a = 5

type1a.a = 7472

type1a.d = 23.1415

type1a.s = "YES"

type2a.a = "43 - forty three"

type2a.o.s = "Yaba Daba Doo"

type3a.c.o.s = "COS"

type2b.a = "943 - nine hundred and forty three"

type2b.o.s = "Yogi"

MsgBox type1a.a

MsgBox type1a.d

MsgBox type1a.s

MsgBox type2a.a

MsgBox type2a.o.s

MsgBox type2b.a

MsgBox type2b.o.s

MsgBox type3a.c.o.s

MsgBox a

End Sub

### UBound Function

Current Help System: PC-DMIS BASIC (View Core Help)

## UBound Function

Ubound(arrayname[,dimension])

Returns the value of the largest usable subscript for the specified dimension of an array.

Related Topics: Dim, Global, Lbound, and Option Base

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

' This example demonstrates some of the features of arrays. The lower bound

' for an array is 0 unless it is specified or option base is set it as is

' done in this example.

Option Base 1

Sub Main

Dim a(10) As Double

MsgBox "LBound: " & LBound(a) & " UBound: " & UBound(a)

Dim i As Integer

For i = 1 to 3

a(i) = 2 + i

Next i

Print a(1),a(1),a(2), a(3)

End Sub

### UCase Function

Current Help System: PC-DMIS BASIC (View Core Help)

## UCase Function

Ucase (String )

Returns a copy of String in which all lowercase characters have been converted to uppercase.

Related Topics: Lcase, Lcase$ Function

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

' This example uses the LTrim and RTrim functions to strip leading and

' trailing spaces, respectively, from a string variable. It

' uses the Trim function alone to strip both types of spaces.

' LCase and UCase are also shown in this example as well as the use

' of nested function calls

Sub Main

MyString = " <-Trim-> " ' Initialize string.

TrimString = LTrim(MyString) ' TrimString = "<-Trim-> ".

MsgBox "|" & TrimString & "|"

TrimString = LCase(RTrim(MyString)) ' TrimString = " <-trim->".

MsgBox "|" & TrimString & "|"

TrimString = LTrim(RTrim(MyString)) ' TrimString = "<-Trim->".

MsgBox "|" & TrimString & "|"

' Using the Trim function alone achieves the same result.

TrimString = UCase(Trim(MyString)) ' TrimString = "<-TRIM->".

MsgBox "|" & TrimString & "|"

End Sub

### Val

Current Help System: PC-DMIS BASIC (View Core Help)

## Val

Val(string)

Returns the numeric value of a string of characters.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub main

Dim Msg

Dim YourVal As Double

YourVal = Val(InputBox$("Enter a number"))

Msg = "The number you enered is: " & YourVal

MsgBox Msg

End Sub

### VarType

Current Help System: PC-DMIS BASIC (View Core Help)

## VarType

VarType(varname)

Returns a value that indicates how the parameter varname is stored internally.

The parameter varname is a variant data type.

VarType | return values:
Empty | 0
Null | 1
Integer | 2
Long | 3
Single | 4
Double | 5
Currency | 6 (not available at this time)
Date/Time | 7
String | 8

Related Topics: IsNull, IsNumeric

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

If VarType(x) = 5 Then

Print "Vartype is Double" 'Display variable type

End If

### Weekday Function

Current Help System: PC-DMIS BASIC (View Core Help)

## Weekday Function

Weekday(date,firstdayof week)

Returns a integer containing the whole number for the weekday it is representing.

Related Topics: Hour, Second, Minute, Day

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main()

x = Weekday(#5/29/1959#)

Print x

End Sub

### While...Wend Statement

Current Help System: PC-DMIS BASIC (View Core Help)

## While...Wend Statement

While condition

.

.

.

[StatementBlock]

.

.

.

Wend

While begins the while...Wend flow of control structure. Condition is any numeric or expression that evaluates to true or false. If the condition is true the statements are executed. The statements can be any number of valid Enable Basic statements. Wend ends the While...Wend flow of control structure.

Related Topics: Do...Loop Statement

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main

Const Max = 5

Dim A(5) As String

A(1) = "Programmer"

A(2) = "Engineer"

A(3) = "President"

A(4) = "Tech Support"

A(5) = "Sales"

Exchange = True

While Exchange

Exchange = False

For I = 1 To Max

MsgBox A(I)

Next I

Wend

End Sub

### With Statement

Current Help System: PC-DMIS BASIC (View Core Help)

## With Statement

With object

[STATEMENTS]

End With

The With statement allows you to proeform a series of commands or statements on a particular object without again refering to the name of that object. With statements can be nested by putting one With block within another With block. You will need to fully specify any object in an inner With block to any memeber of an object in an outer With block.

Related Topics: While…Wend Statement and Do Loop

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

' This sample shows some of the features of user defined types and the with

' statement

Type type1

a As Integer

d As Double

s As String

End Type

Type type2

a As String

o As type1

End Type

Dim type1a As type1

Dim type2a As type2

Sub Main ()

With type1a

.a = 65

.d = 3.14

End With

With type2a

.a = "Hello, world"

With .o

.s = "Goodbye"

End With

End With

type1a.s = "YES"

MsgBox type1a.a

MsgBox type1a.d

MsgBox type1a.s

MsgBox type2a.a

MsgBox type2a.o.s

End Sub

### Write # - Statement

Current Help System: PC-DMIS BASIC (View Core Help)

## Write # - Statement

Write #filenumber [,parameterlist ]

Writes and formats data to a sequential file that must be opened in output or append mode.

A comma delimited list of the supplied parameters is written to the indicated file. If no parameters are present, the newline character is all that will be written to the file.

Related Topics: Open and Print# Statements

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main ()

Open "TESTFILE" For Output As #1 ' Open to write file.

userData1$ = InputBox ("Enter your own text here")

userData2$ = InputBox ("Enter more of your own text here")

Write #1, "This is a test of the Write # statement."

Write #1,userData1$, userData2

Close #1

Open "TESTFILE" for Input As #2 ' Open to read file.

Do While Not EOF(2)

Line Input #2, FileData ' Read a line of data.

PRint FileData ' Construct message.

Loop

Close #2 ' Close all open files.

MsgBox "Testing Print Statement" ' Display message.

Kill "TESTFILE" ' Remove file from disk.

End Sub

### Year Function

Current Help System: PC-DMIS BASIC (View Core Help)

## Year Function

Year(serial# )

Returns an integer representing a year between 1930 and 2029, inclusive. The returned integer represents the year of the serial parameter.

The parameter serial# is a string that represents a date.

If serial is a Null, this function returns a Null.

Related Topics: Date, Date$ Function/Statement, Day, Hour, Month, Minute, Now, Second.

More:

Example:

Current Help System: PC-DMIS BASIC (View Core Help)

Example:

Sub Main

MyDate = "11/11/94"

x = Year(MyDate)

print x

End Sub

PC-DMIS