DO12 - SelectRange help

How to select editbox text when I enable checkbox ?
Dlg.Control("edit1").SelectRange(0, -1) give me error.

[code]<?xml version="1.0"?>


@script VBScript
Function OnClick(ByRef clickData)
Set Dlg = DOpus.Dlg
Dlg.window = clickData.func.sourcetab
Dlg.template = "Test"
Dlg.detach = True
Set Msg = Dlg.GetMsg()
If Msg.event = "click" Then Call CheckboxChecked(Dlg, Msg)
Loop While Msg
End Function

Sub CheckboxChecked(ByRef Dlg, ByRef Msg)
If Msg.control = "check1" Then
If Dlg.Control("check1").value = True Then
Dlg.Control("edit1").enabled = True
Dlg.Control("edit1").focus = True
Dlg.Control("edit1").SelectRange(0, -1)
Dlg.Control("edit1").enabled = False
End If
End If
End Sub

<resource name="Test" type="dialog">
<dialog fontsize="8" height="61" lang="Francais" standard_buttons="cancel" title="Test" width="150">
<language height="130" lang="english" title="Renommage de fichier" width="396" />
<control height="10" name="check1" title="Check this" type="check" width="48" x="13" y="17">
<language height="10" lang="english" title="Replace" width="64" x="18" y="18" />
<control enable="no" halign="left" height="12" name="edit1" title="select this" type="edit" width="66" x="73" y="16" />
<control close="1" height="14" name="button1" title="OK" type="button" width="50" x="39" y="43" />


It's a VBScript parsing error, not a script error:

[quote]Error at line 18, position 49
Dlg.Control("edit1").SelectRange(0, -1)

Cannot use parentheses when calling a Sub (0x800a0414)[/quote]

In VBScript (for some strange reason) you can't use parentheses around the arguments unless you are capturing the return value from the function call. Change it as follows:

Dlg.Control("edit1").SelectRange 0, -1

VB, it's so weird! o)
You can use "call" in front of the line to make "regular" syntax work:

Call Dlg.Control("edit1").SelectRange( 0, -1)