<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic GetString with Keywords FATAL ERROR in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373735#M56775</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i encountered a problem, when I try to use GetString with Keywords&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim optString As New PromptStringOptions("Zadaj nazov: ")
optString.Keywords.Add("Vypisat")

Dim resPrompt As PromptResult = ed.GetString(optString)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AutoCAD crashes with FATAL ERROR on the last line.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Mar 2012 09:43:27 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-03-16T09:43:27Z</dc:date>
    <item>
      <title>GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373735#M56775</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i encountered a problem, when I try to use GetString with Keywords&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim optString As New PromptStringOptions("Zadaj nazov: ")
optString.Keywords.Add("Vypisat")

Dim resPrompt As PromptResult = ed.GetString(optString)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AutoCAD crashes with FATAL ERROR on the last line.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2012 09:43:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373735#M56775</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-16T09:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373781#M56776</link>
      <description>&lt;P&gt;You need to use PromptKeywordOptions like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            Dim optstring As New PromptKeywordOptions("Zadaj nazov: ")
            optstring.Keywords.Add("Vypisat")
            Dim resPrompt As PromptResult = ed.GetKeywords(optstring)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2012 10:50:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373781#M56776</guid>
      <dc:creator>Paulio</dc:creator>
      <dc:date>2012-03-16T10:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373787#M56777</link>
      <description>&lt;P&gt;You can't add keywords to Getstring method&lt;/P&gt;&lt;P&gt;But you might be want to use DefaultValue property&lt;/P&gt;&lt;P&gt;to get possibility for empty input&lt;/P&gt;&lt;P&gt;And also you always use Try.. Catch statement to&lt;/P&gt;&lt;P&gt;save your working time &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;See sample:&lt;/P&gt;&lt;PRE&gt;        Public Sub testkwords()
            Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim db As Database = doc.Database
            Dim ed As Editor = doc.Editor
            Try
                Dim optString As New PromptStringOptions("Zadaj nazov: ")
                optString.UseDefaultValue = True
                optString.AppendKeywordsToMessage = True
                optString.DefaultValue = "Vypisat"
                Dim resPrompt As PromptResult = ed.GetString(optString)
                If resPrompt.Status &amp;lt;&amp;gt; PromptStatus.OK Then
                    Return
                End If
                Dim strRes As String = resPrompt.StringResult
                MsgBox(strRes)
            Catch ex As System.Exception
                MsgBox(ex.Message + vbCrLf + ex.StackTrace)
            Finally

            End Try
        End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2012 10:52:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373787#M56777</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-16T10:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373813#M56778</link>
      <description>&lt;P&gt;to Paulio: keyword prompt only allows to enter keyword, i want an user inputed string, or a keyword&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to Hallex: &lt;SPAN&gt;Thanks for the workaround.&lt;/SPAN&gt;&amp;nbsp;That's strange, that PromptStringOptions has a Property Keywords and then throws an exception saying Keywords are not allowed.&lt;/P&gt;&lt;P&gt;I think that I will have to stick with this, but it's strange to have a Keyword in &amp;lt;&amp;gt; instead of [], very odd behavior. Whay if I wanted to have more than one keyword?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2012 11:10:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3373813#M56778</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-16T11:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3374185#M56779</link>
      <description>&lt;P&gt;If you need to add more than one keyword&lt;/P&gt;&lt;P&gt;you have to use ed.getkword method, see examples,&lt;/P&gt;&lt;P&gt;hope you will be undrerstand how to use this functions,&lt;/P&gt;&lt;P&gt;feel free to adopt them to your needs:&lt;/P&gt;&lt;PRE&gt;        Function PromptKeyWords(ByVal PromptStr As String, ByVal kwords As String(), ByVal deflt As String) As Boolean
            Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor

            Dim prOpt As PromptKeywordOptions = New PromptKeywordOptions(PromptStr)
            Dim prRes As PromptResult = Nothing
            prOpt.AppendKeywordsToMessage = True
            For Each wd As String In kwords
                prOpt.Keywords.Add(wd)
            Next
            prOpt.Keywords.Default = deflt
            prOpt.SetMessageAndKeywords(PromptStr, "[Yes/No]")
            prOpt.Keywords.Add("[")

            prOpt.Keywords.Add("[")

            prOpt.AppendKeywordsToMessage = True

            prRes = ed.GetKeywords(prOpt)

            If prRes.Status = PromptStatus.Cancel Then
                MsgBox("Error: user cancelled")
                Return False
            Else
                MsgBox(prRes.StringResult)
                Return True
            End If

        End Function


        Public Shared Function GetKwordOut(ByVal ed As Editor, ByVal msg As String, ByVal kwords As String()) As String
            Dim pko As New PromptKeywordOptions(vbLf + msg)
            pko.AllowNone = True

            For Each itm As String In kwords
                pko.Keywords.Add(itm)
            Next
            pko.Keywords.Default = kwords.GetValue(kwords.Length - 1).ToString()
            Dim pkr As PromptResult = ed.GetKeywords(pko)
            If pkr.Status &amp;lt;&amp;gt; PromptStatus.OK Then
                Return String.Empty
            Else
                Return pkr.StringResult
            End If
        End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#993366" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2012 14:36:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3374185#M56779</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-16T14:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375797#M56780</link>
      <description>&lt;P&gt;Hallex, you didn't understand what I meat.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want a string prompt, i want user to be able to enter a string, any string and also be able to choose a keyword for some action. But I guess it's not possible.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2012 07:01:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375797#M56780</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-19T07:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375899#M56781</link>
      <description>&lt;P&gt;Sorry, Matus&lt;/P&gt;&lt;P&gt;I have disagreed completely&lt;/P&gt;&lt;P&gt;You didn't understand how to use the function I posted&lt;/P&gt;&lt;P&gt;Please, try complete solution:&lt;/P&gt;&lt;PRE&gt;       &amp;lt;CommandMethod("MatusBrilt", "matus", CommandFlags.Modal)&amp;gt; _
    Public Sub SampleTest()
        Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
        Dim kwords As String() = {"Rectangle", "Circle", "Ellipse", "Squiggle"}
        Dim strout As String = GetKwordOut(ed, vbLf + "Choose a Shape Type or Enter Another Type You Want: ", kwords)
        ed.WriteMessage(vbLf + "{0}", strout)
    End Sub



    Public Shared Function GetKwordOut(ByVal ed As Editor, ByVal msg As String, ByVal kwords As String()) As String
        Dim pko As New PromptKeywordOptions(vbLf + msg)
        pko.AllowNone = True
        pko.AllowArbitraryInput = True
        For Each itm As String In kwords
            pko.Keywords.Add(itm)
        Next
        pko.Keywords.Default = kwords.GetValue(kwords.Length - 1).ToString()
        Dim pkr As PromptResult = ed.GetKeywords(pko)
        If pkr.Status &amp;lt;&amp;gt; PromptStatus.OK Then
            Return String.Empty
        Else
            Return pkr.StringResult
        End If
    End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#339966" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2012 08:47:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375899#M56781</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-19T08:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375913#M56782</link>
      <description>&lt;P&gt;If I enter anything else in the eg.GetKeywords prompt, I get an error "Invalid option keyword." and I am prompted again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use AutoCAD 2012.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2012 08:57:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375913#M56782</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-19T08:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375933#M56783</link>
      <description>&lt;P&gt;You have to copy code I posted in the last post because I've added&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;ArbitaryInput=True&lt;/FONT&gt; in this function&lt;/P&gt;&lt;P&gt;Then it will be&amp;nbsp;work as you need, see what I have a got after running the code&lt;/P&gt;&lt;P&gt;(tested on 2010th) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;Command: MATUS Choose a Shape Type or Enter Another Type You Want [Rectangle/Circle/Ellipse/Squiggle] &amp;lt;Squiggle&amp;gt;: Trapezoid&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;Trapezoid&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff"&gt;&amp;nbsp;Command:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800000" face="arial,helvetica,sans-serif"&gt;~'J'~﻿&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2012 09:41:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375933#M56783</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-19T09:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375957#M56784</link>
      <description>&lt;P&gt;oh, finally &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much, I missed that one&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2012 10:24:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375957#M56784</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-19T10:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375997#M56785</link>
      <description>&lt;P&gt;You're welcome&lt;/P&gt;&lt;P&gt;Happy coding &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#cc99ff" face="arial,helvetica,sans-serif"&gt;~'J'~&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2012 11:18:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/3375997#M56785</guid>
      <dc:creator>Hallex</dc:creator>
      <dc:date>2012-03-19T11:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: GetString with Keywords FATAL ERROR</title>
      <link>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/6847583#M56786</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;great suggestion, helped me out &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thx, - alfred -&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 22:22:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getstring-with-keywords-fatal-error/m-p/6847583#M56786</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2017-02-01T22:22:44Z</dc:date>
    </item>
  </channel>
</rss>

