Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From what I understand that attribute is only recognised by certain file based methods to help structure content written to/read from files. The compiler will not use that attribute to alter how a variable assignment is compiled.</p> <p>Taken from MSDN:</p> <blockquote> <p>The VBFixedStringAttribute is informational and cannot be used to convert a variable length string to a fixed string. The purpose of this attribute is to modify how strings in structures and non-local variables are used by methods or API calls that recognize the VBFixedStringAttribute. Keep in mind that this attribute does not change the actual length of the string itself.</p> </blockquote> <p>The last sentence is the important bit:</p> <blockquote> <p>Keep in mind that this attribute does not change the actual length of the string itself.</p> </blockquote> <p><a href="http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.vbfixedstringattribute.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.vbfixedstringattribute.aspx</a></p> <p>EDIT 1:</p> <p>A quick example on how to auto-padding a string based on a fixed length:</p> <pre><code>Function FixedLengthString(ByVal value As String, ByVal totalLength As Integer, ByVal padding As Char) As String Dim length = value.Length If (length &gt; totalLength) Then Return value.Substring(0, totalLength) Return value.PadRight(totalLength, padding) End Function </code></pre> <p>Here you can pass in a string and if the length of the string is greater than the specified total length you will get a string matching that length. Anything less and you'll get the string plus the padding character upto the specified total length.</p> <p>This can be improved with error checking and maybe making the method an extension method so you don't have to pass "value".</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload