<?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 Re: VB.Net Restricting TextBox to Positive Long or Double in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420559#M11316</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The alternative would be to disable the execute button until all entries were valid and use labels to highlight errors.&amp;nbsp; I assume that is the approach you are recommending.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I was thinking of something more straightforward, as in when the user clicks the execute button, a boolean method would first check the validity of the input as a group and set caption messages next to the invalid input. Once the boolean method returns true, continue on with the execute logic. Execute would be three methods.&amp;nbsp; The boolean validity check of the execute click action, the validity check itself, and the exectue.&amp;nbsp; Then you wouldn't have all of those keypress and leave events firing around.&amp;nbsp; Imagine if you had to debug this code and had to switch between the form and the code to trace your way through those events.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I will try searching for it (wish me luck)&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;lol.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Aug 2012 13:12:43 GMT</pubDate>
    <dc:creator>LeoDonahue</dc:creator>
    <dc:date>2012-08-29T13:12:43Z</dc:date>
    <item>
      <title>VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420553#M11310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have been searching the internet for ideas on how to restrict a VB.Net System.Windows.Forms.TextBox control to only accept positive Long or positive Double numeric values.&amp;nbsp; I think I have come up with a good control set up, primarily based on &lt;/SPAN&gt;&lt;A href="http://social.msdn.microsoft.com/Forums/en-GB/Vsexpressvb/thread/aab1d64c-a9dc-4dd2-8d2f-83a414e9c909" rel="nofollow noopener noreferrer" target="_blank"&gt;this post on msdn&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; The code within the KeyPress and Leave events below is generic and can be pasted into any Textbox KeyPress and Leave events to produce the behaviors described below.&amp;nbsp; I am posting this in case it helps others and also to see if anyone has a more elegant way of doing this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For this example, the behavior criteria of my Long Textbox are as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; When the user finishes editing in the Textbox the value of the Textbox must be a Long interger that is positive and greater than or equal to 1 (in this example the Textbox represents an annual average daily trip count which cannot be negative and which is used as a divisor in an equation, so at least 1 annual average daily trip must occur on the road for a valid analysis).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; From the keyboard the user must only be able to type numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; The user may paste text into the Textbox.&amp;nbsp; This introduces the possibility for insertion of negative numbers, floating values, and invalid entries which must be resolved in the following ways:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a.&amp;nbsp; If a negative number is pasted into the Textbox, it must be reset to its absolute value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;b.&amp;nbsp; If a floating number is pasted into the Textbox, it must be rounded to a whole interger.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;c.&amp;nbsp; If the user pastes invalid text into the Textbox and does not correct an invalid entry prior to leaving the Textbox, the user will be permitted to exit the textbox, but the invalid value will be replaced by the minimum default value (in this case 1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4.&amp;nbsp; If a user attempts to leave the Textbox with a blank entry or an entry of 0, the user is permitted to leave but the textbox will be completed using the minimum default value (in this case 1).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;5.&amp;nbsp; Numbers must always be corrected to a conventional format when the user leaves the Textbox.&amp;nbsp; In other words, a user may enter a value of 023 into the Textbox, but when he exits the Textbox it must appear as 23.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code that implements this behavior.&amp;nbsp; The Textbox in this specific example is named txtAADT; however, the code written within the KeyPress and Leave Subs is generic and can be pasted into these two events for any other Textbox to implement the same behavior.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Imports System.Math

&amp;nbsp; Private Sub txtAADT_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAADT.KeyPress
&amp;nbsp;&amp;nbsp;&amp;nbsp; # If the keystroke is not a numeric digit, the keystroke will be disregarded.&amp;nbsp; Code works for any Textbox KeyPress event.
&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not (Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar)) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Handled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp; End Sub

&amp;nbsp; Private Sub txtAADT_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAADT.Leave
&amp;nbsp;&amp;nbsp;&amp;nbsp; # User has completed their entry and is leaving the Textbox.

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a Textbox variable to make the code below generic so that it can be pasted into any Textbox Leave event
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim tbx As System.Windows.Forms.TextBox = sender

&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim value As Double
&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not Double.TryParse(tbx.Text, value) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The user did not correct an invalid entry so replace it with 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf value &amp;lt; -1 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The user pasted a negative value, so make sure it is rounded and take its absolute value
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = Abs(CLng(value))
&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf value &amp;lt; 1 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The user has entered 0 or pasted in a value between -1 and 1, so replace with minimum value of 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf value = vbNull Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The user has blanked out the Textbox, so fill in the Textbox with the minimum value of 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The user has entered a valid postive number, so make sure it is rounded and appears as a conventional number
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = CLng(value)
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp; End Sub
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The positive Double Textbox has similar requirements to the positive Long Textbox, but it allows an optional single decimal point to be inserted to create non-integer values.&amp;nbsp; (The code is not designed at this time to respond to local Cultural settings for the decimal character, so that would be a nice enhancement if anyone cares to suggest the code required to do that.)&amp;nbsp; The following additional or different behaviors are implement with the positive Double Textbox:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; When the user finishes editing in the Textbox the value of the Textbox must be a Double value that is positive and greater than or equal to 0 (in this example the Textbox represents a Distance of offset from an intersection which cannot be negative, but which may be 0 where no offset is desired).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp; From the keyboard the user must only be able to type numbers and at most one decimal character.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3.&amp;nbsp; The user may paste text into the Textbox.&amp;nbsp; This introduces the possibility for insertion of negative numbers and invalid entries which must be resolved in the following ways:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a.&amp;nbsp; If a negative number is pasted into the Textbox, it must be reset to its absolute value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;b.&amp;nbsp; If the user pastes invalid text into the Textbox and does not correct an invalid entry prior to leaving the Textbox, the user will be permitted to exit the textbox, but the invalid value will be replaced by the minimum default value (in this case 0).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4.&amp;nbsp; If a user attempts to leave the Textbox with a blank entry, the user is permitted to leave but the textbox will be completed using the minimum default value (in this case 0).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;5&amp;nbsp; A maximum of 4 fractional digits are permitted.&amp;nbsp; Any fractional digits beyond that must be rounded.&amp;nbsp; (This is due to the maximum resolution of the data)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;6.&amp;nbsp; Numbers must always be corrected to a conventional format when the user leaves the Textbox.&amp;nbsp; In other words, a user may enter a value of 023.123456 into the Textbox, but when he exits the Textbox it must appear as 23.1235.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code for the positive Double Textbox.&amp;nbsp; The Textbox in this specific example is named txtDistance1; however, the code written within the KeyPress and Leave Subs is generic and can be pasted into these two events for any other Textbox to implement the same behavior.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Imports System.Math

&amp;nbsp; Private Sub txtDistance1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDistance1.KeyPress
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a Textbox variable so that the code within this KeyPress event is generic for all positive Double Textboxes.
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim tbx As System.Windows.Forms.TextBox = sender
&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not (Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar) Or (e.KeyChar = "." And tbx.Text.IndexOf(".") &amp;lt; 0) Or (e.KeyChar = "." And tbx.Text.IndexOf(".") &amp;gt;= 0 And tbx.SelectionLength &amp;gt; 0 And tbx.SelectionStart &amp;lt;= tbx.Text.IndexOf(".") And tbx.SelectionStart + tbx.SelectionLength &amp;gt; tbx.Text.IndexOf("."))) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Explanation: Prevent the keystroke if it is not a numeric digit, a non-printable character such as a Backspace, or a decimal point where no decimal point exists in the Textbox or where the existing decimal point is contained in a text selection that will be overwritten by the new decimal point.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Handled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp; End Sub

&amp;nbsp; Private Sub txtDistance1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDistance1.Leave
&amp;nbsp;&amp;nbsp;&amp;nbsp; # User has completed their entry and is leaving the Textbox

&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a Textbox variable so that the code below is generic and can be pasted into any Textbox Leave event
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim tbx As System.Windows.Forms.TextBox = sender
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim value As Double
&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not Double.TryParse(tbx.Text, value) Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Textbox value is invalid, so replace it with the minimum default value (in this case 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf value = vbNull Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The user has blanked out the Textbox, so fill in the Textbox with the minimum value of 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf value &amp;gt;= 0 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # value is positive so round to 4 decimal places and correct to conventional format
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = Round(value, 4)
&amp;nbsp;&amp;nbsp;&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # value is negative so round to 4 decimal places, apply the absolute value and correct to conventional format
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbx.Text = Abs(Round(value, 4))
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp; End Sub&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Again, I hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:00:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420553#M11310</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T19:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420554#M11311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What if the user pastes in a hex or unicode escape sequence for a number?&amp;nbsp; Something like 0x0039 or 9 (hilarious, the unicode I pasted in here was converted to the numeric value of 9, which is what I tried pasting in as unicode...)&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/aa664669(v=vs.71).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa664669(v=vs.71).aspx&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, rather than trap for correct input and settle for defaults, you can test the values of the text boxes for numeric and prompt the user for correct input.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your code is only checking for "leave" events, which you hope the user enters a value and leaves that text box.&amp;nbsp; What if the user enters junk into a text box and doesn't do anything to trigger the leave event before they submit?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you find this example?&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms229644(v=vs.80).aspx#Y0"&gt;http://msdn.microsoft.com/en-us/library/ms229644(v=vs.80).aspx#Y0&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 02:13:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420554#M11311</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-29T02:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420555#M11312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What if the user pastes in a hex or unicode escape sequence for a number?&amp;nbsp; Something like 0x0039 or 9&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/aa664669(v=vs.71).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa664669(v=vs.71).aspx&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Also, rather than trap for correct input and settle for defaults, you can test the values of the text boxes for numeric and prompt the user for correct input.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;Your code is only checking for "leave" events, which you hope the user enters a value and leaves that text box.&amp;nbsp; What if the user enters junk into a text box and doesn't do anything to trigger the leave event before they submit?&lt;BR /&gt;&lt;BR /&gt;Did you find this example?&amp;nbsp; &lt;A href="http://msdn.microsoft.com/en-us/library/ms229644(v=vs.80).aspx#Y0"&gt;http://msdn.microsoft.com/en-us/library/ms229644(v=vs.80).aspx#Y0&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I hate the approach of locking a user into a field.&amp;nbsp; I won't do it for myself or them.&amp;nbsp; I don't ever want a prompt.&amp;nbsp; So that is not the way I will design my interface.&amp;nbsp; The pasting example may be a worry to programmers that work in the public shpere, but I only work for in house Engineers, who don't even know that hex codes or escape codes exist.&amp;nbsp; So far I have been unable to submit anything without leaving the dialog except by closing the dialog without posting, which I want to allow.&amp;nbsp; Anyway, I have my preferences and if they don't work for others, that is fine.&amp;nbsp; This is working the way I described and the way I want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, I did not see the help you pointed to and it probably does help to make improvements over my code.&amp;nbsp; I searched for 3 hours on msdn and never hit on the search terms that brought that back.&amp;nbsp; Search systems are a failure more and more everywhere (especially microsoft's).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Something seems to be missing from the example.&amp;nbsp; I got it to compile and it allows the keystrokes it says it will.&amp;nbsp; However, I cannot use an InputPanel in an Add-In form and there is no obvious indentification of where to implement the IntValue or DecimalValue to correct the user's input.&amp;nbsp; It lets the user put in multiple decimal points and negative signs, which I have prevented.&amp;nbsp; With the keyboard a user cannot enter junk in my Textbox or an invalid base 10 number, but a user can in this example.&amp;nbsp; Only pasting creates junk in my Textbox, which is a rare occurance for my particular users.&amp;nbsp; Based on the entries I can type in I would expect errors to arise from the IntValue and DecimalValue properties if I did access them.&amp;nbsp; Again, I understand that for programmers in the public sphere more possibilities need to be handled, but they simply are not worth an hour of my time for my users.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit 2:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I see the potential of the leave event not being fired.&amp;nbsp; Triggering that code in the Submit method is one of the options.&amp;nbsp; If you know of a better event that must fire before a user can execute a command button I would like to know about it.&amp;nbsp; It seems you are suggesting to validate it in the command button itself, which I can do to clean up junk.&amp;nbsp; There is no right way to do this (which is the key reason I love the Python script tool interface.&amp;nbsp; This stuff is built in with one click and it just works without me coding anything.&amp;nbsp; Unfortunately the script tool is slow to load and execute when too much code gets added, which is why I am fighting my frustrations and building it in VB.Net.)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 02:55:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420555#M11312</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T02:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420556#M11313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wasn't thinking about locking a user into a text box before they can move on, rather, a label next to the text box indicating the value entered is invalid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What happens if your user enters more than one decimal point?&amp;nbsp; Such as:&amp;nbsp; .........&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, searches only help if you have the right keywords.&amp;nbsp; I googled:&amp;nbsp; msdn restrict textbox to numbers.&amp;nbsp; First link.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 03:10:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420556#M11313</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-29T03:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420557#M11314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I wasn't thinking about locking a user into a text box before they can move on, rather, a label next to the text box indicating the value entered is invalid.&lt;BR /&gt;&lt;BR /&gt;What happens if your user enters more than one decimal point?&amp;nbsp; Such as:&amp;nbsp; .........&lt;BR /&gt;&lt;BR /&gt;Yes, searches only help if you have the right keywords.&amp;nbsp; I googled:&amp;nbsp; msdn restrict textbox to numbers.&amp;nbsp; First link.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Run my code.&amp;nbsp; Entering more than 1 decimal point in the Double Textbox is impossible with the keyboard.&amp;nbsp; The only way to cause this problem is with pasting (which is not the data entry method users of my form will normally use).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the user insisted on pasting in such a value the code would replace it with the default value if a user insists on exiting the textbox before correcting that entry.&amp;nbsp; A more likely problem would be that they meant to paste over a decimal and instead pasted before or after it and thereby entered two decimal points without realizing it.&amp;nbsp; When they left the Textbox such an entry would be replaced by the default value.&amp;nbsp; I see the point of using a label to notify them about such replacements, but I generally would not let faulty input go uncorrected hoping the user would go back and correct it before pressing the execute button.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The alternative would be to disable the execute button until all entries were valid and use labels to highlight errors.&amp;nbsp; I assume that is the approach you are recommending.&amp;nbsp; I thought I had seen some kind of Validator class that could add error symbols and messages directly to controls (rather than having to generate my own labels all over the form), but I may be misremembering and mixing languages and interfaces.&amp;nbsp; I will try searching for it (wish me luck).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Speaking of funky searches, I had that problem with the Python website too.&amp;nbsp; I was trying to find a Python based method for closing a Windows program.&amp;nbsp; Nowhere was the word "close" associated with that action and I never got any hits in my search.&amp;nbsp; Later another user pointed out that the Python term you need to use for closing a Window was "Kill".&amp;nbsp; But if you search "python kill" you get a lot of articles about deaths in the Amazon and not much on the python language.&amp;nbsp; Sigh.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 04:59:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420557#M11314</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T04:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420558#M11315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's a subroutine I found that I usually put in my text box KeyPress functions when I want to restrict what's being typed in. This doesn't account for hex values, but I doubt that the users would even know what they are. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp; Friend Function ValidateKey(ByVal Key As Integer, ByVal KeyMask As String) As Boolean

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'I wrote this simple general-purpose key-validating function. You might find
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'it useful. just call it like this in your keypress event:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not ValidateKey(Asc(e.KeyChar), "mask") Then e.Handled = True

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '"mask" contains pairs of characters. The function checks that your keypress
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'falls between the ascii range of each pair. For instance if you want to
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'allow only lowercase letters just use "az". If you want only numbers and
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'decimal points use "09.." Include as many pairs as you like.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'PURPOSE: check that a keystroke was allowed by key mask. return true/false

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'declare variable

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim intCharCheck As Integer = 0

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'assume invalid
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ValidateKey = False

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Until intCharCheck = KeyMask.Length Or ValidateKey = True

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'check if keypress falls between pair of characters in KeyMask
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Key &amp;gt;= Asc(KeyMask.Chars(intCharCheck)) And Key &amp;lt;= Asc(KeyMask.Chars(intCharCheck + 1)) Then ValidateKey = True

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'advance to next pair in KeyMask
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; intCharCheck += 2

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'allow backspace and Enter
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Key = System.Windows.Forms.Keys.Back Then ValidateKey = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Catch ex As Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Windows.Forms.MessageBox.Show(ex.ToString, "Utilities: ValidateKey")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Try

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When using this with numbers, I have additional checks to make sure there's not more than one decimal place or negative sign, in addition. Here's an example for a group of textboxes that can be decimal degree or degree minutes seconds or just numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub Numeric_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtLatD.KeyPress, txtLatM.KeyPress, txtLatS.KeyPress, txtLonD.KeyPress, txtLonM.KeyPress, txtLonS.KeyPress, txtLatDD.KeyPress, txtLonDD.KeyPress, txtDistance.KeyPress

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim Mask As String

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Case sender.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case "txtLatD", "txtLonD"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mask = "09--"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case "txtLatDD", "txtLonDD"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mask = "09--.."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mask = "09.."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Select

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not ValidateKey(Asc(e.KeyChar), Mask) Then e.Handled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Asc(e.KeyChar) = 46 Then 'test for existing decimal point
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If InStr(sender.text, ".") &amp;gt; 0 Then e.Handled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Asc(e.KeyChar) = 45 Then 'test for exisiting negative sign
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If InStr(sender.text, "-") &amp;gt; 0 Then e.Handled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If sender.selectionstart &amp;gt; 0 Then e.Handled = True 'Can't have a negative sign other than in the first position
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If

&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420558#M11315</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T19:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420559#M11316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The alternative would be to disable the execute button until all entries were valid and use labels to highlight errors.&amp;nbsp; I assume that is the approach you are recommending.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I was thinking of something more straightforward, as in when the user clicks the execute button, a boolean method would first check the validity of the input as a group and set caption messages next to the invalid input. Once the boolean method returns true, continue on with the execute logic. Execute would be three methods.&amp;nbsp; The boolean validity check of the execute click action, the validity check itself, and the exectue.&amp;nbsp; Then you wouldn't have all of those keypress and leave events firing around.&amp;nbsp; Imagine if you had to debug this code and had to switch between the form and the code to trace your way through those events.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I will try searching for it (wish me luck)&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;lol.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 13:12:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420559#M11316</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-29T13:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420560#M11317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The validity check method could be as simple as the way this text changed method works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.textchanged.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.windows.forms.control.textchanged.aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you also look at the Masked Text Box?&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 13:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420560#M11317</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-29T13:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420561#M11318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Imagine if you had to debug this code and had to switch between the form and the code to trace your way through those events.&lt;BR /&gt;&lt;BR /&gt;lol.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code I wrote does have such a problem in that the code is fully self contained to operate within a single method that has an obvious connection to the behavior of the Textbox.&amp;nbsp; And even if it did cause a problem it is not that much code or difficult to interprete with the commenting I have added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tracing your suggested code involving multiple boolean variables accessed across the entire form is much more likely to miss a code path, because I have to set and trap these flags all over the form, keeping track between methods that fire in orders that I have no control over or clear understanding of.&amp;nbsp; It is easy to set the flag to a condition indicating one or more conditions fails to pass the test for execution, but nearly impossible to set the flag to indicate that widely dispersed operations all combine to allow final form execution without a centeralize check method that queries every relavant part of the form.&amp;nbsp; Attempting to write such a centralize check is much more likely to result in&amp;nbsp; impossible code traces of branching if then else statements and in debug nightmares that isolating each part of the form to play its part in ensuring valid input.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Were I to use your suggested set of boolean variables I would be sure that they affected the enabled status of the execute button, so that I could eliminate the user's ability to proceed on that path until the variables are set correctly for execution and visually see on the form what the boolean variable state was for any given set of user actions to assist me in debugging the ever expanding code paths.&amp;nbsp; But I have gone down that road before and have always regretted it when I want to make additions or modifications to the forms behaviors.&amp;nbsp; Every new option affecting the boolean variables seems to result in an exponential growth of code paths and unexpected combinations of conditions that I have to spend a lot of time tracing out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I still am not convinced that using default values to replace obvious garbage that can only be generated through rare user actions is a bad idea.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you actually run my code to see for yourself how it works?&amp;nbsp; I have been running the code you have referenced.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 14:02:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420561#M11318</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T14:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420562#M11319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The problem with putting it into the TextChanged subroutine is that the user can put in invalid characters into the text box, whereas the KeyPress validation won't put those invalid characters there to begin with. Using the code from the MS example, you can still see something like this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]17327[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It looks like the Masked Textbox requires more user interaction with decimal numbers, requiring them to position the cursor at the correct location to put in a number that has fewer numbers than the maximum number.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 14:03:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420562#M11319</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2012-08-29T14:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420563#M11320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not doing a good job of being clear.&amp;nbsp; Let me try again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While trying to limit what a user can enter into an input control is fine, you should also validate that input before you use it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Example:&amp;nbsp; Esri's map scale tool.&amp;nbsp; You can type letters in there, but when you hit enter, you'll get a message indicating that what you typed is junk.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]17329[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 14:15:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420563#M11320</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-29T14:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420564#M11321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The problem with putting it into the TextChanged subroutine is that the user can put in invalid characters into the text box, whereas the KeyPress validation won't put those invalid characters there to begin with. Using the code from the MS example, you can still see something like this&lt;BR /&gt;&lt;BR /&gt;[ATTACH=CONFIG]17327[/ATTACH]&lt;BR /&gt;&lt;BR /&gt;It looks like the Masked Textbox requires more user interaction with decimal numbers, requiring them to position the cursor at the correct location to put in a number that has fewer numbers than the maximum number.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I concur on both statements.&amp;nbsp; The Keypress operation does the best job of ensuring keyboard actions cannot result in unwanted characters and can even restrict certain characters to a certain number of occurrances (as my code has shown) or even to specific positions (were I to use a negative sign I could write a KeyPress routine that ensured the negative sign only occurred once at the beginning of the number and that any attemp to type numbers to the left of it would result in the numbers being placed after the negative sign, without requiring the user to move their cursor to that position).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Restricting cursor movements within the textbox to specific locations that match a mask are unacceptable to me.&amp;nbsp; Text entry needs to be like normal typing, with all standard editing operations, such as select and overwrite abilities, allowed using intelligent character ordering through the keyboard keypress operation.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pasting is the sole path to entering garbage in the Textbox and I have no problem discouraging that practice and penalizing a user for careless use of that data entry method if they do not care to conform to the form's business rules.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When Federal and State Transportation Agencies, State Engineering and Surveying Licensing Boards, and my Department's policy formally adopt standards to accomdate document submissions and field data recordings using hex values and escape codes I will revise my Textbox to accomodate such numbers.&amp;nbsp; But until then, such entries will be treated as the junk that they are.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 14:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420564#M11321</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T14:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420565#M11322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I'm not doing a good job of being clear.&amp;nbsp; Let me try again.&lt;BR /&gt;&lt;BR /&gt;While trying to limit what a user can enter into an input control is fine, you should also validate that input before you use it.&lt;BR /&gt;&lt;BR /&gt;Example:&amp;nbsp; Esri's map scale tool.&amp;nbsp; You can type letters in there, but when you hit enter, you'll get a message indicating that what you typed is junk.&lt;BR /&gt;&lt;BR /&gt;[ATTACH=CONFIG]17329[/ATTACH]&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I concur with this practice of the warning (not the typing of invalid characters from the keyboard), provided that the invalid data would be immediately replaced by valid data and that the warning would only serve to notify the user that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"You typed - 12.345.678 - which not a valid Base 10 Double Number.&amp;nbsp; Your invalid entry has been replaced by the default value of 1."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This warning (which is better than a generalized failure notice) would allow the user to recover from their error by recopying their failed entry and pasting it back into the form at which point they could make appropriate corrections according the form's requirements (i.e. 12345.678).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I feel certain that the keyboard for my Textbox is bulletproof (and can be made that way for alternative requirements through the KeyPress method), but I definitely would like to have a more foolproof set of behaviors for the responding to the paste option.&amp;nbsp; While in my particular case I do not want thousands separators in the Textbox on my form, I would prefer to add a subroutine that would accept pasted numbers with thousands separators as valid numbers and that would reformat them as numbers without thousands separators.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The key to solving this appears to be to find the events that always fire when the paste occurs and when the user is done entering their text by whatever method (perhaps Losing Focus).&amp;nbsp; I could really use a flowchart outlining the order of more events than just KeyDown, KeyPress, and KeyUp to understand my options.&amp;nbsp; I will continue looking into the options.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 14:55:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420565#M11322</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T14:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420566#M11323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't want to be known for beating a dead horse, but I don't see where you are testing the validity of an integer value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What if user enters this:&amp;nbsp; 9,223,372,036,854,775,808 (which is larger than the maximum integer size by one) into your integer checking leave event?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 15:12:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420566#M11323</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-29T15:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420567#M11324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I don't want to be known for beating a dead horse, but I don't see where you are testing the validity of an integer value.&lt;BR /&gt;&lt;BR /&gt;What if user enters this:&amp;nbsp; 9,223,372,036,854,775,808 (which is larger than the maximum integer size by one) into your integer checking leave event?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the keyboard this number could only be entered as: 9223372036854775808 according to my intentional disallowance of the thousands separator.&amp;nbsp; Assuming the Leave event triggered this value would be replaced by 1 as an invalid value, since it would not parse to a valid Long value, but that is not a problem, because it is far beyond the valid maximum number my form can use.&amp;nbsp; The maximum number for my form's Long value is well below the one you have suggested, being at most 7 digits long for any real world AADT.&amp;nbsp; The Leave event already has tests for numbers that are too small (anything below 1 for the Long field example), and adding additional tests for the total number of characters entered for a Long value would be an easy test to add to restrict the number to a valid maximum range.&amp;nbsp; Exceeding the maximum number would be corrected by replacing the input with the maximum value allowed instead of the minimum value.&amp;nbsp; I would definitely have other tests specific to my application that would also ensure that the distances entered actually kept the event on my real roads, none of which is anywhere near this long in any standard units of measure I use.&amp;nbsp; Testing for character length of the Double value on each side of the decimal place would also be an easy test to add for the Double Textbox, and thank you for alerting me to this ommision.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regardless of where I put it, the code I have used in the Leave event is the minimum validation code I need to have executed, whether it occurs there or in an execute button or whereever.&amp;nbsp; So I just need to find the best place to put it to make it fire.&amp;nbsp; My desire is to have it tested as soon as possible upon a user finishing with his entry, which in most cases should be long before the user gets to the point of trying to execute the form if they are filling it in normally (12 completed fields are required for execution in my case).&amp;nbsp; At this stage I would be inclined to keep the Leave event in my code (with the addition of a maximum value validation) and just add a double check routine to be executed just prior to form execution to ensure that the user did not find a way around triggering the Leave event.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 15:38:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420567#M11324</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T15:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420568#M11325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Here's a subroutine I found that I usually put in my text box KeyPress functions when I want to restrict what's being typed in. This doesn't account for hex values, but I doubt that the users would even know what they are... &lt;BR /&gt;&lt;BR /&gt;When using this with numbers, I have additional checks to make sure there's not more than one decimal place or negative sign, in addition. Here's an example for a group of textboxes that can be decimal degree or degree minutes seconds or just numbers...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It took me a while to understand how the mask worked, but the second example of the decimal degrees or degrees minutes seconds helped me figure it out.&amp;nbsp; I assume you have other checks that would deal with minutes and seconds being between 0 and 59 that you did not publish, or did I miss something?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You also designed this with multiple textboxes for the Degrees Minutes Seconds input.&amp;nbsp; Do you have any idea how it would be written to work as a single Textbox. Say that the user set a checkbox to specify the format mask they were entering so that one Textbox could accept a variety of formats depending on user preference at the time of data entry and that internal code would convert it to match the format specifications of a database field.&amp;nbsp; (I realize the check box could expose different sets of Textbox fields to handle and preparse each format, which would be a safer design, but I am trying to explore the limits of what a Textbox can do in this discussion thread).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 16:12:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420568#M11325</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T16:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420569#M11326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Your code is only checking for "leave" events, which you hope the user enters a value and leaves that text box.&amp;nbsp; What if the user enters junk into a text box and doesn't do anything to trigger the leave event before they submit?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have not encountered any case where I have been able to execute a button that submits the form's data for execution without first triggering the Leave event of the Textbox (whether or not I changed anything in the Textbox), so unless you can show me a way to submit without triggering the Leave event I don't think your second comment applies.&amp;nbsp; Therefore I have every reason to believe that the KeyPress and Leave events are all that is required to ensure that a valid entry will be in the Textbox when the user has finished with that field and wants to submit their results for execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So at this point I plan on amending my original code to add a check in the Leave event for the allowable maximum value and to provide a notification prior to execution of the form to the user to let him know when his entry was rejected, what the invalid value was that he entered, and that the value was replaced with a default minimum or maximum value so that he is aware of his error and can optionally correct it before proceeding with execution.&amp;nbsp; I also plan to revise the code to use globalization methods that will use the decimal character that conforms to a users local cultural settings for the benefit of programmers working in other cultures that would want to use my code (although that code may need to have its behavior verified by a programmer in another culture before putting it in use).&amp;nbsp; Finally, I plan on determining the local setting for the thousands separator and parsing it out of an entry that was pasted into the textbox so that it will be treated as a valid number and accepted in the field (subject to the other checks).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 17:57:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420569#M11326</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T17:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420570#M11327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It took me a while to understand how the mask worked, but the second example of the decimal degrees or degrees minutes seconds helped me figure it out.&amp;nbsp; I assume you have other checks that would deal with minutes and seconds being between 0 and 59 that you did not publish, or did I miss something?&lt;BR /&gt;&lt;BR /&gt;You also designed this with multiple textboxes for the Degrees Minutes Seconds input.&amp;nbsp; Do you have any idea how it would be written to work as a single Textbox. Say that the user set a checkbox to specify the format mask they were entering so that one Textbox could accept a variety of formats depending on user preference at the time of data entry and that internal code would convert it to match the format specifications of a database field.&amp;nbsp; (I realize the check box could expose different sets of Textbox fields to handle and preparse each format, which would be a safer design, but I am trying to explore the limits of what a Textbox can do in this discussion thread).&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my case, I was using a radio button to allow the user to enter positions by decimal degree or DMS by making one set of text boxes visible and the other invisible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could do this by using something like &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
If chkInteger.Checked Then&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Mask = "09--"
Else
&amp;nbsp;&amp;nbsp;&amp;nbsp; Mask = "09--.."
End If
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You'd have to incorporate validation in the checkbox in case the user selects that check box after typing in a value.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:00:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420570#M11327</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T19:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420571#M11328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have not encountered any case where I have been able to execute a button that submits the form's data for execution without first triggering the Leave event of the Textbox (whether or not I changed anything in the Textbox), so unless you can show me a way to submit without triggering the Leave event I don't think your second comment applies.&amp;nbsp; &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;You would be able to submit a form button without the leave event triggering if your button has a hot key assigned to it, such as the Text property of your button reads: &amp;amp;Submit&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That would submit your form with no values, assuming you have a hot key assigned to your button, which you probably don't.&amp;nbsp; But also means that if you wanted one, you would be forced to validate your input for all text boxes in the event the form is submitted without any values.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 19:13:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420571#M11328</guid>
      <dc:creator>LeoDonahue</dc:creator>
      <dc:date>2012-08-29T19:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: VB.Net Restricting TextBox to Positive Long or Double</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420572#M11329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You would be able to submit a form button without the leave event triggering if your button has a hot key assigned to it, such as the Text property of your button reads: &amp;amp;Submit&lt;BR /&gt;&lt;BR /&gt;That would submit your form with no values, assuming you have a hot key assigned to your button, which you probably don't.&amp;nbsp; But also means that if you wanted one, you would be forced to validate your input for all text boxes in the event the form is submitted without any values.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Given that validating the input data is the primary function of my form I would not assign a hot key to let the user submit the form without firing the Leave event.&amp;nbsp; If I did, you are correct that I would have to find another location (the submit button) to do the validation.&amp;nbsp; Is there a way to detect that a hot key was used?&amp;nbsp; If so the additional validation would only need to occur if the hot key was triggered.&amp;nbsp; Probably the best compromise would be to create separate Subs of Functions that placed the validation contents currently within the Leave event outside of that event.&amp;nbsp; That way the method could be called from both the Leave event and the Submit button.&amp;nbsp; Then the validation would always occur with whichever event fired earliest, which is my preference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2012 23:37:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-restricting-textbox-to-positive-long-or/m-p/420572#M11329</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2012-08-29T23:37:13Z</dc:date>
    </item>
  </channel>
</rss>

