Public Structure TMProduct
        <VBFixedString(25)> Public productline As String
        <VBFixedString(25)> Public hinban As String
        <VBFixedString(25)> Public shortcode As String
        <VBFixedString(25)> Public fusible As String
        Public nutcount As Integer
        <VBFixedArray(11)> Public nuts() As Integer
        <VBFixedString(512), VBFixedArray(11)> Public tips() As String
End Structure

in VB6 the length of this structure is "12514"
and I used LenB function.

but LenB is not supported in VB.Net
I've reading on some other forums that they use Marshal.SizeOf
but in my case it doesn't do as LenB

In order to compute the length of a structure mostly you'll need to create a default (dummy) instance of it an then compute their size.

Maybe this code, from Jim Mischel, is valid for you:

public static int GetSize<T>()
{
  Type tt = typeof(T);
  int size;
  if (tt.IsValueType)
  {
    if (tt.IsGenericType)
    {
      Console.WriteLine("{0} is a generic value type", tt.Name);
      var t = default(T);
      size = Marshal.SizeOf(t);
    }
    else
    {
      Console.WriteLine("{0} is a value type", tt.Name);
      size = Marshal.SizeOf(tt);
    }
  }
  else
  {
    Console.WriteLine("{0} is a reference type", tt.Name);
    size = IntPtr.Size;
  }
  Console.WriteLine("Size = {0}", size);
  return size;
}

Then call it using int structsize = GetSize(TMProduct) The Console output is just for debugging purposes an can be easely removed :)

Hope this helps

commented: nothing personal, just .cs code in .vb forum. -3

didn't tried it but thanks, I didn't use structures anymore coz i'm not very familiar with it and fileput.. anyway thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.