Hi everyone,

As the title says I am have two problems:

1) I want to copy a template database (.dbf) and name it based upon user input into an edit box, however, I am getting an error when I try to compile my code saying that the PChat type is incompatible with the String type. Is there any way I can solve this? The example code can be found below.

{There is an edit box on the form called EditBox1 and a button called Button1. The template database is called template.dbf and is in the databases directly. I wish to copy the new file to the same directory.}

procedure TForm1.Button1Click(Sender: TObject);
var getname : String;
begin
getname := concat('databases\',Edit1.Text,'.dbf');
CopyFile('races2.dbf',getname,true);
end;

2) Secondly I would like to obtain the string value of the currently selected item of a Win32 Tree View. I do not have any code to illustrate my problem so I have used a similar item (a combo box) to show you what I would like to do.

{There is a combo box on the form called ComboBox1 and a button called Button1.} 

procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(ComboBox1.Text);
end;

Basically what I am asking is how would I use the above code with a Win32 Tree View rather than a Combo Box?

Thanks in advance

Never mind found it out by myself. I needed to use PChar() on the String and do a TreeView1.Selected.Text;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.