String to Type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RamBabuze
    New Member
    • Dec 2007
    • 1

    String to Type

    Hello all, I need some help here. I am using Visual Basic 6.0 (SP6).

    Here's an example of the code I need:


    Private Type PURCH_Record
    Order as String * 6
    Supplier as String * 6
    Name as String * 30
    TotalValue as String * 10
    OrderedOn as string * 8
    RequiredOn as string * 8
    End Type

    Dim sLine as String
    Dim rPURCH as PURCH_Record

    Open "C:\TEXT.tx t" For Input As # 1
    Line Input #1, sLine

    Now I want to copy the content of sLine into rPURCH... A simple

    rPURCH = sLine

    does not work. I tried working with


    Call CopyMemory(rPUR CH, sLine, len(rPURCH))

    it does not work either. I know I could do it field by field using the mid() function, but I got several types of record each containing several fields. It sounds to me that there is a better way of doing that.

    Thanks in advance.
Working...