Thema: Delphi From VB to Delphi

Einzelnen Beitrag anzeigen

Benutzerbild von sirius
sirius

Registriert seit: 3. Jan 2007
Ort: Dresden
3.443 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: From VB to Delphi

  Alt 4. Apr 2007, 09:56
I suppose that MSComm1, Text1 and lblTP are special components. The last one could by a label

I'm not sure. but maybe this could be a translation:
Delphi-Quellcode:
procedure cmdTPButtonClick(...); //whatever the click-event is...
//defining temporal/local variables
var myString:string
    TP_string:string;
    Temp:string;
    TP_float:double;
    B1:string;
    B2:double;
begin
  myString:=''; //This is not neccessary if this variable stays local.
  MSComm1.output:='0111' + vbCR; // vbCR?
  myString:=MSComm1.Input;
  Test1.Text:=myString;
  Temp:=MidStr(myString,12,3);
  if pos('>',myString) > 0 then
  begin
    B1:=MidStr(MyString, 7, 2);
    B2:=strtoint('$'+B1);
    TP_float:=B2/256*100;
    TP_string:=inttostr(round(TP_float));
    lablTP.Caption:=TP_string + ' %';
  end; //Else - part is empty
end;
I don't know if some of those temporal variables are also used global. vbCR is either a global variable too or it is a special constant.
Dieser Beitrag ist für Jugendliche unter 18 Jahren nicht geeignet.
  Mit Zitat antworten Zitat