Solved

i have problems with Timage

Posted on 1999-01-12
3
156 Views
Last Modified: 2010-04-06
I use an Timage for capture an image of Clipboard (Ctrl+V), then when the user press the
button (save) my code is:

Procedure Tform1.Button1click(Sender:Tobject);
var
  st:Tfilestream;
begin
  if not table1.findkey([key.text]) then
  begin
    table1.appendrecord([key.text,name.text]);
    st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);
    image1.picture.graphic.savetostream(st);
    Table1.edit;
    Tblobfield(table1.fieldbyname('Photo')).loadfromstream(St);
    table1.post;
  end;
end;
     
and i have other Button

Tform1.Button2click(Sender:Tobject) ;
var
  st:Tfilestream;
begin
  if table1.findkey([key.text]) then
  begin
    name.text:=table1.fieldbyname('Name').asstring;
    st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);
    Tblobfield(Table1.fieldbyname('Photo')).savetostream(st);
    image1.picture.graphic.loadfromstream(st);
  end
  else
    caption:='Error';
end;

the 2 procedures not mark noting error, but when i press the Button2 only The Name.text
are filled but the Image1 noting

why

Thanks

i wait for not bother : )
0
Comment
Question by:jamiguel
  • 2
3 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1356186
The LoadFromStream call does not recognise the file extension. You should set it to the approprite one (eg: .BMP for bitmap etc)

Cheers,

Raymond.
0
 

Author Comment

by:jamiguel
ID: 1356187
but the extension is that of less, since I have proven without extension, or I have to put you the extension .BMP, what is the way perfect, can you  illustrate me with any code the correct form?
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 0 total points
ID: 1356188
I think you should change this line

   st:=Tfilestream.create('c:\temp\temp.xxx',fmcreate);

to this

   st:=Tfilestream.create('c:\temp\temp.bmp',fmcreate);

I would also reset the stream position before reading in the image eg:

   st.position := 0;
   image1.picture.graphic.loadfromstream(st);


Raymond
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi OLE Error 8 93
Working with hours 3 45
How do I add a client SSL certificate to a SOAP client in Rad Studio Delphi? 2 39
Firemonkey DbLookupComboBox equivalent ? 2 32
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now