Einzelnen Beitrag anzeigen

Hobbycoder

Registriert seit: 22. Feb 2017
930 Beiträge
 
#4

AW: Funktionsaufruf innerhalb With..do => access violation

  Alt 6. Mär 2017, 11:08
Der Erfolg gibt die Recht. So funktioniert es.

Kannst du mir auch erklären warum?

Delphi-Quellcode:
procedure Tfrm_Adressbuch.btn_aendernClick(Sender: TObject);
var
  LKZ, ONKZ, RN: string;
  idxLKZ, idxONKZ: Integer;
  faxnummer: string;
  Adresse: Tfrm_Adresse;
begin
  if lv_adressen.Selected=nil then Exit;
  Adresse:=Tfrm_Adresse.Create(self);
  try
    Adresse.edt_name.Text:=Adressbuch[lv_adressen.Selected.Index].Name;
    Adresse.edt_vorname.Text:=Adressbuch[lv_adressen.Selected.Index].Vorname;
    Adresse.edt_firma.Text:=Adressbuch[lv_adressen.Selected.Index].Firma;
    faxnummer:=Adressbuch[lv_adressen.Selected.Index].Faxnummer;
    faxnummer:=ValidateNumber(faxnummer, CountryList, ONKZList, Settings.OwnCountryPrefix, Settings.OwnCityPrefix, LKZ, ONKZ, RN, idxLKZ, idxONKZ);
    Adresse.edt_faxnummer.Text:=faxnummer;
    if idxLKZ>-1 then Adresse.lbl_LKZ.Caption:=CountryList[idxLKZ].CountryDE;
    if idxONKZ>-1 then Adresse.lbl_ONKZ.Caption:=ONKZList[idxONKZ].Ort;
    CountryList:=Self.CountryList;
    ONKZList:=Self.ONKZList;
    Settings:=Self.Settings;
    if Adresse.ShowModal=mrOK then
    begin
      Adressbuch[lv_adressen.Selected.Index].Name:=Adresse.edt_name.Text;
      Adressbuch[lv_adressen.Selected.Index].Vorname:=Adresse.edt_vorname.Text;
      Adressbuch[lv_adressen.Selected.Index].Firma:=Adresse.edt_firma.Text;
      Adressbuch[lv_adressen.Selected.Index].Faxnummer:=Adresse.edt_faxnummer.Text;
      Adressbuch.SortByName;
      Adressbuch.SaveToFile(AdressenFilename);
      BuildLV;
    end;
  finally
    Adresse.Free;
  end;
end;
  Mit Zitat antworten Zitat