﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » How do I find length of bound field - programatically?</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 14 Sep 2026 22:55:57 GMT</lastBuildDate><ttl>20</ttl><item><title>How do I find length of bound field - programatically?</title><link>http://forum.strataframe.net/FindPost9473.aspx</link><description>I'm wanting to set the maxlength at run-time to the length of the bound field.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I've got a textbox bound to a varchar(20) field.&amp;nbsp; If I want the maxlength of my textbox to be 20, how do I find out what that field's size is - in code?</description><pubDate>Tue, 12 Jun 2007 13:32:04 GMT</pubDate><dc:creator>Howard Bennett</dc:creator></item><item><title>RE: How do I find length of bound field - programatically?</title><link>http://forum.strataframe.net/FindPost9509.aspx</link><description>Thanks for the clarification...</description><pubDate>Tue, 12 Jun 2007 13:32:04 GMT</pubDate><dc:creator>Howard Bennett</dc:creator></item><item><title>RE: How do I find length of bound field - programatically?</title><link>http://forum.strataframe.net/FindPost9508.aspx</link><description>Thanks for your help!</description><pubDate>Tue, 12 Jun 2007 13:28:59 GMT</pubDate><dc:creator>Howard Bennett</dc:creator></item><item><title>RE: How do I find length of bound field - programatically?</title><link>http://forum.strataframe.net/FindPost9494.aspx</link><description>However, rmoore is right... if you ever need to test on the length of the data in a field, you can use BO.FieldName.Length (like if you're testing for a business rule to make sure a user has entered a minimum amount of data or something.</description><pubDate>Tue, 12 Jun 2007 09:06:07 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: How do I find length of bound field - programatically?</title><link>http://forum.strataframe.net/FindPost9493.aspx</link><description>That FieldName.Length property is the actual length of the string returned by that property, so it's not going to be 20... what you want to use is the FieldLengths property.&amp;nbsp; It's a dictionary of all of the fields lengths listed by the field name.&amp;nbsp; So, set your textbox like this:&lt;/P&gt;&lt;P&gt;Me.myTextBox.MaxLength = Me.bo1.FieldLengths("FieldName")</description><pubDate>Tue, 12 Jun 2007 09:05:05 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: How do I find length of bound field - programatically?</title><link>http://forum.strataframe.net/FindPost9483.aspx</link><description>The BO has a property called Length. You can access it by doing: &lt;br&gt;
[codesnippet]MyBO.FieldName.Length()[/codesnippet]</description><pubDate>Mon, 11 Jun 2007 15:59:35 GMT</pubDate><dc:creator>rmoore</dc:creator></item></channel></rss>