<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://customerfx.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jason Buss&amp;#39; Blog : text, Development, input</title><link>http://customerfx.com/pages/customization/archive/tags/text/Development/input/default.aspx</link><description>Tags: text, Development, input</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP2 (Build: 20611.960)</generator><item><title>Forcing Numeric Input in SalesLogix Fields</title><link>http://customerfx.com/pages/customization/2008/06/05/forcing-numeric-input-in-saleslogix-fields.aspx</link><pubDate>Thu, 05 Jun 2008 13:20:00 GMT</pubDate><guid isPermaLink="false">e15581aa-2787-4c59-a940-524c09f5d256:39409</guid><dc:creator>Jason Buss</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://customerfx.com/pages/customization/rsscomments.aspx?PostID=39409</wfw:commentRss><comments>http://customerfx.com/pages/customization/2008/06/05/forcing-numeric-input-in-saleslogix-fields.aspx#comments</comments><description>&lt;p&gt;Often times, you need to force a particular type of input to a SalesLogix field.&amp;nbsp; There are a couple ways to do this: If the&amp;nbsp;control is mapped to an numeric database field, an error will be displayed stating that alpha characters are not allowed; otherwise, you can set the format type of the control to ftInteger, but that will not prevent alpha entry.&amp;nbsp; It will only prevent any non-numeric values from being displayed (any non-numeric value would display as &amp;#39;0&amp;#39;).&lt;/p&gt;
&lt;p&gt;The method I use frequently, is to evaluate the key pressed in the control, and set the control to readonly based on what is being entered...&lt;/p&gt;
&lt;p&gt;Adding this code to a text boxes KeyPress event will force the control to only accept numeric input.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;i&gt;Sub TextBox1KeyPress(Sender, ByRef Key)&lt;/i&gt;&lt;/p&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (key &amp;lt; 48 or key &amp;gt; 57) and key &amp;lt;&amp;gt; 46 and key &amp;lt;&amp;gt; 127 and key &amp;lt;&amp;gt; 8 then&lt;/i&gt;&lt;/p&gt;
&lt;p style="margin:0in 0in 0in 0.5in;font-size:10pt;font-family:Verdana;"&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sender.readonly = true&lt;/i&gt;&lt;/p&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/i&gt;&lt;/p&gt;
&lt;p style="margin:0in 0in 0in 0.5in;font-size:10pt;font-family:Verdana;"&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sender.readonly = false&lt;/i&gt;&lt;/p&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/i&gt;&lt;/p&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;&lt;i&gt;&lt;/i&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;&lt;i&gt;End Sub&lt;/i&gt;&lt;/p&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;&lt;i&gt;&lt;/i&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;This code could be modified to exclude any key from writing to the control, it would just be a matter of determining the key value for any key you want to exclude.&lt;/p&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0in;font-size:10pt;font-family:Verdana;"&gt;(I got this code from Kris Halsrud (thanks Kris!).&amp;nbsp; You can view his blog on integration at &lt;a href="http://customerfx.com/pages/integrationblog/default.aspx"&gt;http://customerfx.com/pages/integrationblog/default.aspx&lt;/a&gt;)&lt;/p&gt;&lt;img src="http://customerfx.com/aggbug.aspx?PostID=39409" width="1" height="1"&gt;</description><category domain="http://customerfx.com/pages/customization/archive/tags/SalesLogix+LAN+Client/default.aspx">SalesLogix LAN Client</category><category domain="http://customerfx.com/pages/customization/archive/tags/Customizations/default.aspx">Customizations</category><category domain="http://customerfx.com/pages/customization/archive/tags/Development/default.aspx">Development</category><category domain="http://customerfx.com/pages/customization/archive/tags/input/default.aspx">input</category><category domain="http://customerfx.com/pages/customization/archive/tags/text/default.aspx">text</category></item></channel></rss>