There are two problems here, converting from decimal (base 10) to Roman numerals and from Roman numerals to denary.
Roman numbers follow a rather complex pattern with symbols for 1(I), 5 (V), 10(X), 50(L), 100(C), 500(D) and 1,000(M).
To make other numbers symbols are combined, thus II=2, LX=60, DCC=700, CD=400, and so on.
When a numeral comes before one that is smaller the two numbers are added, thus VI=6 (5+1).
When a numeral comes before one that is greater the first is subtracted from the second , thus IV=4 (5-1). A maximum of one numeral should precede a larger one so 8 is VIII, not IIX. The difference between the two numbers must be no more than one order of magnitude, thus XC (100-10) is permissible but XD (500-10) or XM (1,000-10) are not (490=CDXC, 499=CDLXLIX, 990=CMXC, 999=CMLXLIX).
To convert a decimal number to Roman numerals the individual digits of the decimal number must be isolated, for example in converting 1,234 we need to isolate the 1, the 2, the 3 and the 4.
We might declare some variables such as: thousands, hundreds, tens, units: integer;
We might then set up some if statements along the lines:
if thousands = 1 then romanthousands := 'M';
if thousands = 2 then romanthousands := 'MM';
...
if units = 8 then romanunits:='VIII';
You should be able to see where this is going and it will make for a lot of if statements. We could also use case but this does not help to reduce the large number of if statements to be evaluated. An alternative approach is to declare some arrays of strings and populate them with Roman numerals:
procedure TForm1.FormCreate(Sender: TObject);
begin
thousands[1]:='';
thousands[2] := 'M';
thousands[3] := 'MM';
thousands[4] := 'MMM';
hundreds[1]:='';
hundreds[2]:='C';
...
We can now use the digits of the decimal number, which we already know how to isolate, as indices of the arrays. Thus the first cell of the array is set to zero, which has no roman character and so is set to empty. The second cell in the array is set to 1 (or 10, or 100, or 1,000), and so on. The use of cell index 1 for zero means we have to add 1 to the index if we are to access the correct roman numerals, for example cell 2 holds 'I', cell 3 holds 'II', and so on. Notice that in Pascal array indices start at 1; in C++ we could start indexing at 0 and produce a slightly cleaner solution.
Here is a simple form:

The code to process the 'To Roman' button might thus be: click to view.
Working from the right to the left of a Roman number we might have:
VI: first character is 'I', value=1; second character is greater than first so add the two: 6.
IV: first character is 'V', value=5; second character is less than first so subtract second from first: 4.