could not find source location to hatası

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
a_self_lion
Üye
Mesajlar: 93
Kayıt: 01 Eki 2008 07:04

could not find source location to hatası

Mesaj gönderen a_self_lion »

Selam Arkadaşlar;
button1 e tıkladığımda onclick ini yani şu hata msjını veriyo
could not find source location to add method button1."END." or INITILATION not found on unit form
bulunamadı fln diyor ama hepsini koydum formun üzerine,neden böyle bi hata verirki?


unit deki kodlarım şu şekilde

Kod: Tümünü seç


unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ShellApi, StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
   kullanici : string
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
var
a : TextFile;
begin

if FileExists(ExtractFilePath(Application.ExeName)+'kullanici.txt') then
 begin
 AssignFile(a,ExtractFilePath(Application.ExeName)+'kullanici.txt');
 Reset(a);

 while not Eof(a) do
 Readln(a,kullanici);
 ShowMessage(Kullanici); // kullanici = Project2.exe nin Public kısmında
                         //  tanımladığımız değişken ...
 end;
end ;


end.
Kullanıcı avatarı
conari
Üye
Mesajlar: 2102
Kayıt: 27 Nis 2006 03:10
Konum: İstanbul & Gebze Karışık

Re: could not find source location to hatası

Mesaj gönderen conari »

kodlarda problem yok gibi.
projeyi kapatıp bir aç istersen.
Bir kelimenin anlamını öğretsen bile yeter..
ResimResim
a_self_lion
Üye
Mesajlar: 93
Kayıt: 01 Eki 2008 07:04

Re: could not find source location to hatası

Mesaj gönderen a_self_lion »

conari yazdı:kodlarda problem yok gibi.
projeyi kapatıp bir aç istersen.
Kaç defa kapatıp açtım çıldırttı beni. :)))
Kullanıcı avatarı
conari
Üye
Mesajlar: 2102
Kayıt: 27 Nis 2006 03:10
Konum: İstanbul & Gebze Karışık

Re: could not find source location to hatası

Mesaj gönderen conari »

Butonu kaldır compile et. sonra tekrar ekle.
Kodları alıp kendi projeme koydum problem yok. :wink:
Bir kelimenin anlamını öğretsen bile yeter..
ResimResim
Kullanıcı avatarı
sabanakman
Kıdemli Üye
Mesajlar: 3081
Kayıt: 17 Nis 2006 08:11
Konum: Ah bi Antalya olaydı keşke (Ankara)

Re: could not find source location to hatası

Mesaj gönderen sabanakman »

son satıra da CloseFile(a); satırı ekleyerek deneyin.
Şaban Şahin AKMAN
_________________
Derin olan kuyu değil kısa olan iptir. - .
Kullanıcı avatarı
Lost Soul
Üye
Mesajlar: 1064
Kayıt: 01 Nis 2007 02:55
Konum: mekan ANKARA toprak ELAZIĞ
İletişim:

Re: could not find source location to hatası

Mesaj gönderen Lost Soul »

Kod: Tümünü seç

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ShellApi, StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
   kullanici : string;//************************
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
var
a : TextFile;
begin

  if FileExists(ExtractFilePath(Application.ExeName)+'kullanici.txt') then
  begin
    AssignFile(a,ExtractFilePath(Application.ExeName)+'kullanici.txt');
    Reset(a);
    while not Eof(a) do
    Begin//************************
      Readln(a,kullanici);
      ShowMessage(Kullanici);
    end;//************************
    CloseFile(a);//************************
  end ;
end;



end.
Cevapla