MessageDlg wrong delphi type?

MessageDlg(myinfo.totret, mtInformation, [mbOK], 0, mbOK);

Open in new window


myinfo.totret is type double

I get the following error:

There is no overload version of 'MessageDlg' that can be called with these arguments. I think it's because I'm using type double instead of type string in the MessageDlg code, not sure the easiest way to convert?

Thanks,
keats88Asked:
Who is Participating?
 
Ephraim WangoyaCommented:
Remove the last mbOK

Change this to
MessageDlg(FloatToStr(myinfo.totret), mtInformation, [mbOK], 0)

Open in new window

0
 
Ephraim WangoyaCommented:

it needs a string

MessageDlg(FloatToStr(myinfo.totret), mtInformation, [mbOK], 0, mbOK)
0
 
keats88Author Commented:
Perfect, thank you! This is my first attempt at a language that is strongly typed and it's presenting me some head aches, but will make my code better in the long run I suppose.
0
 
Ephraim WangoyaCommented:

Practice makes perfect, just hang in there
0
 
KoenVandemoortelCommented:
For example:
MessageDlg(format('%g', [myinfo.totret]) , mtInformation, [mbOK], 0, mbOK);

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.