CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    6

    UDT - string length from Variable

    I have to call a C DLL. The according header specifies e.g. the following variable:

    #define DBCP_FH_LENGTH 80

    I made the following of it in the VB Declaration segment.

    private DBCP_FH_LENGTH as string * 80




    The header reuses this variable in a C structure
    typedef struct tagDBCOOP {
    ... [many stuff]
    char FHtext[DBCP_FH_LENGTH];
    ...
    } cDBCOOP;
    I translated this to a UDT:

    private Type cDBCOOP
    ....
    szFHtext as string * [DBCP_FH_LENGTH]
    'Vb want to see a constant expression, next try:
    szFHtext as string * DBCP_FH_LENGTH
    'same error as the one above
    szFHtext as string * (DBCP_FH_LENGTH)
    'does not compile.

    'is there a way to avoid
    szFHtext as string * 80




    any help would be appreciated,

    Annette



  2. #2
    Join Date
    Sep 1999
    Posts
    202

    Re: UDT - string length from Variable

    option Explicit
    private Const DBCP_FH_LENGTH as Long = 80 ' #define DBCP_FH_LENGTH 80
    private szFHtext as string * DBCP_FH_LENGTH

    private Sub Form_Click()
    MsgBox len(szFHtext)
    End Sub





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured