StrToInt question

Posted on 2007-08-03
Last Modified: 2013-11-05
Dear Experts,

procedure TConnectHost.ConClick(Sender: TObject);
  if HostName.Text <> '' then
    ConnectHostName := HostName.Text;
    ConnectPortName := StrToInt(PortName.Text);   <======= put the text entered in the editbox
                                                                                                    in a variabele.

What do I have to put in de FormShow-event:

  ActiveControl := HostName;
  HostName.Text := ConnectHostName;
  IntToStr(PortName.Text) := ConnectPortName; <===this is not correct what the whright syntax?


Question by:peterkiers
    LVL 1

    Author Comment

    I got: [Error] Connectu.pas(43): Incompatible types: 'String' and 'Integer'
    LVL 17

    Assisted Solution

    give Your variables definitions.
    ConnectPortName suggests to be a string variable
    if so
    ConnectPortName := PortName.Text;

    In any case
    this won't be correct
    IntToStr(PortName.Text) := ConnectPortName;
    LVL 1

    Author Comment

    Sorry, i forgot to tell that ConnectPortName is an Integer.

    With this line:
      PortName.Text := ConnectPortName;

    I get the message:
    I got: [Error] Connectu.pas(43): Incompatible types: 'String' and 'Integer'

    LVL 19

    Accepted Solution


      PortName.Text := IntToStr(ConnectPortName);
    LVL 1

    Author Comment

    Thanks for the help.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    779 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

    13 Experts available now in Live!

    Get 1:1 Help Now