GetString Method

The GetString method prompts the user for input of a string at the AutoCAD Command prompt. This method accepts two parameters. The first parameter controls the input of spaces in the input string. If it is set to 0, spaces are not allowed (SPACEBAR terminates the input); if set to 1, the string can contain spaces (ENTER must be used to terminate the input). The second parameter is the prompt string.

Get a string value from the user at the AutoCAD command line

The following example displays the Enter Your Name prompt, and requires that the input from the user be terminated by pressing ENTER (spaces are allowed in the input string). The string value is stored in the retVal variable and is displayed using a message box.

Sub Ch3_GetStringFromUser()
	Dim retVal As String
	retVal = ThisDrawing.Utility.GetString _
			 (1, vbCrLf & "Enter your name: ")
	MsgBox "The name entered was: " & retVal
End Sub

The GetString method does not honor a prior call to the InitializeUserInput method.