DexGetstring()
The DexGetstring() function creates a dialog box that allows the user to enter a string, and returns a boolean value indicating whether the user clicked OK or Cancel in the dialog box. When the dialog is closed, the string will be returned in the variable named in the string_variable parameter.
Syntax
DexGetstring(prompt, password, string_variable)
Parameters
• prompt - A string with the message to be displayed in the dialog box.
• password - A boolean value indicating how the entry will be displayed. If set to true, the characters typed will be obscured, preventing others from seeing what is being entered. If set to false, the user's entry will appear normally.
• string_variable - If this variable contains a value, it will appear as a default when the dialog is displayed. When the user closes the dialog by clicking OK or Cancel, the value in the dialog will be returned to this variable.
Return value
A boolean. If OK was clicked, the value of true is returned, and the string entered by the user is returned to the string_variable parameter. If Cancel was clicked, only the boolean value false is returned.
Examples
The following C# example shows the DexGetstring() function being used to ask for a password. If the string supplied by the user matches the word "magic" then access is granted. Notice how the string value must be passed in as a reference value to this function.
string string_val = ""; bool result; result = Dynamics.Forms.SyVisualStudioHelper.Functions.DexGetstring .Invoke("Enter the password", true, ref string_val, 0); if (result == true) { if (string_val == "magic") { Dynamics.Forms.SyVisualStudioHelper.Functions.DexWarning .Invoke("Access granted"); } }
The following Visual Basic example shows the DexGetstring() function being used to ask for a password. If the string supplied by the user matches the word "magic" then access is granted.
Dim string_val As String = "" Dim result As Boolean result = Dynamics.Forms.SyVisualStudioHelper.Functions.DexGetstring. _ Invoke("Enter the password", True, string_val, 0) If result = True Then If string_val = "magic" Then Dynamics.Forms.SyVisualStudioHelper.Functions.DexWarning. _ Invoke("Access granted") End If End If