C/Front, Visual Basic & BLOB-Fields

KromozoneKromozone Member Posts: 47
Community,

i'm working on a small Visual Basic Tool. The User can scan Sheets and Reports and my Tool should save them in then Navision Database via C/FRONT OCX.

On VB side, the Bitmap is saved into an Byte-Array. But how can i save this Array into an BLOB-Field on Navision side?

I can write Text and other datatypes, but i have no more idea's to save the Bitmap as BLOB.

Thank you for your Help!

Regards

Andreas Nebel
Kisling Consulting GmbH, Neckarsulm
www.kisling-consulting.de

Comments

  • DoomhammerDoomhammer Member Posts: 211
    youľl need to export picture into bitmap file (BMP, single picture per record) and import it to BLOB.

    here is sample code taken from Navision 3.70 - form Company info, menu button Picture
    PictureExists=boolean
    Picture=BLOB field in Company Information
    text001=confirmation string
    
    PictureExists := Picture.HASVALUE;
    IF Picture.IMPORT('*.BMP',TRUE) = '' THEN
      EXIT;
    IF PictureExists THEN
      IF NOT CONFIRM(Text001,FALSE) THEN
        EXIT;
    CurrForm.SAVERECORD;
    
    Martin Bokůvka, AxiomProvis
  • KromozoneKromozone Member Posts: 47
    Thank you for your reply.

    My problem was the byte-array on VB side. I only had to write the binary into an flat variable and then -> it works!

    Andy
  • janpieterjanpieter Member Posts: 298
    I think the VB code should be something like this:
    Dim intFF as integer
    Dim intCount as integer
    
    intFF = Freefile
    
    Open "c:\image.bmp" for output as intFF
    
    For intCount = 1 to UBound(ByteArray)
         Put intFF, ByteArray(intCount)
    Next intCount
    
    Close intFF
    

    I assume the byte array has the exact content of the bmp file?

    I have never worked with a byte aray though. I don't know why you chose that, think it is the same as a string isn't it?

    How do you fill the byte array?

    Regards Jan-Pieter
    In a world without Borders or Fences, who needs Windows and Gates?
  • KromozoneKromozone Member Posts: 47
    Here's my function. Works perfectly now.
    Function MakeBinaryLargeObject(strFilename As String, varBinaryLargeObject As Variant) As Boolean
        'Erstellt BLOB-Feld aus übergebener Datei
        Dim bytBinaryLargeObject() As Byte
        
        Open App.Path & "\" & strFilename For Binary As 1
        ReDim bytBinaryLargeObject(LOF(1))
        Get 1, 1, bytBinaryLargeObject
        Close 1
        varBinaryLargeObject = bytBinaryLargeObject
        
        'Quelldatei wird gelöscht
        Kill App.Path & "\" & strFilename
    
    End Function
    

    As Yet I write the Content of the Bitmap-File into an Byte-Array. But if i want to put them to C/Side, it has to be a flat variant. That was all :(
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Hi,

    I am also facing the same problem,

    I believe you have solved your problem , if yes please help me in solving my problem also.

    Thank in advance
    Ravi,
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
  • garakgarak Member Posts: 3,263
    @Ravi_Thakkar

    do you have read Kromozone's code snippes :?:
    Do you make it right, it works too!
  • Ravi_ThakkarRavi_Thakkar Member Posts: 392
    Hi All,

    Recentally I have got the solution for my query.
    Thanks to you all. :P
    Ravi_Thakkar
    Ahmedabad, Gujarat, India
    E Mail : ravi.thakkar@hotmail.com
Sign In or Register to comment.