I am trying to get my code to work more like some of the built in autocad commands below is the code I have come up with. However if the string returned is not a Keyword or a string that can be converted to a double it is then not acceptable input. How do I jump back to re ask for the input. I could use goto I guess but thats not good practice is there a better way?
'ask the user if they want to accept the sureface level at the lid level or enter a new one
Dim acDoc AsDocument = Application.DocumentManager.MdiActiveDocument
Dim pKeyOpts AsPromptKeywordOptions = NewPromptKeywordOptions("")
Dim CurrentLidLevel AsDouble = oStructure.RimElevation
pKeyOpts.Message = vbLf &
"Structure Lid Level:" & CurrentLidLevel
'pKeyOpts.Keywords.Default = "New"
Dim pKeyRes AsPromptResult = acDoc.Editor.GetKeywords(pKeyOpts)
Lidlevel = CurrentLidLevel
'ask user for grade to use
Lidlevel = acDoc.Editor.GetDouble(vbCrLf &
"Enter New lid level of Structure").Value
'Enter key hit
"using surface level for lid level")
'Check if input was a number that we can work with
Catch ex AsException
'enter pressed do nothing
Use GetDouble with PromptDoubleOptions and AutoCAD will automatically reprompt if the user enters anything that is not a double or a keyword. Setting AllowNone = true allows the Enter Key.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register