How to declare a fixed-length string in VB.NET?

Rachel picture Rachel · Feb 21, 2010 · Viewed 65.1k times · Source

How do i Declare a string like this:

Dim strBuff As String * 256

in VB.NET?

Answer

Spencer Ruport picture Spencer Ruport · Feb 21, 2010

Use the VBFixedString attribute. See the MSDN info here

<VBFixedString(256)>Dim strBuff As String