07 June 2011

Store image in table

Create a table with Container Datatype
IN form take a method getImage() write the following code.
_path = "Image path"
void getImage()
{
Bindata binData = new BinData();
FilePath _path;
ImageStore _ImageStore;

;
_path = "D:\India_flag.gif"; // file path
binData.loadFile(_path);

_ImageStore.ItemImage = binData.getData();
_ImageStore.doInsert();
}
__
take a button and call this method there:
void clicked()
{
super();

element.getImage();
ImageStore_ds.executeQuery();

}

1 comment:

  1. Hi I have a question

    _path = "D:\India_flag.gif"; // file path
    binData.loadFile(_path);

    those two lines, when i use like that i got error, it said that the file cannot open. I have tried _path = "D:\\India_flag.gif"; // file path works.
    but when I get the file path from a table field (fielpath), then you get the path will be like
    ""D:\India_flag.gif"; // file path "!
    btw: i use ax 2012
    How can i solve it?

    ReplyDelete

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...