0

Error I'm getting

I'm confused if it could be the constant values in the separate unit I'm using (all validation coded is in this separate unit) or if it could be because of the way I'm trying to change the Datasource.

Code Of The Button

begin
  if ObjValideering.CheckAdminLogin = False then
  ShowMessage('U ingevulde Wagwoord en ID kombinasie is verkeerd');
  tsOutput.Visible := True;
  pgcViva.ActivePage := tsOutput;

    if rdgAdminKeuses.ItemIndex = 0 then
    begin
      dbgInfo.DataSource := VivaData_u.FDataSet.dsWerkers;
      VivaData_u.FDataSet.Enabled := True;
    end;
      if rdgAdminKeuses.ItemIndex = 1 then
      begin
        dbgInfo.DataSource := VivaData_u.FDataSet.dsDonateers;
        VivaData_u.FDataSet.Enabled := True;
      end;
       if rdgAdminKeuses.ItemIndex = 2 then
       begin
          dbgInfo.DataSource := VivaData_u.FDataSet.dsProjekte;
          VivaData_u.FDataSet.Enabled := True;
       end;
         if rdgAdminKeuses.ItemIndex = 3 then
         begin
           dbgInfo.DataSource := VivaData_u.FDataSet.dsAdmins;
           VivaData_u.FDataSet.Enabled := True;
         end;

end;

Error Occurs at :
 if (fAdminPass = arradminLogin[i,1]) AND (fAdminID = arradminLogin[i,0]) then

Mjhenning
  • 11
  • 1
  • 1
    When you step through the code using F8, on which line does the Access Violation occur? – Freddie Bell Aug 17 '21 at 16:02
  • It doesn't throw an error out at a line at all.. Just throws out an Exception Class. – Mjhenning Aug 17 '21 at 16:28
  • An Access Violation is an exception... On which line does it occurs? You should learn how to use a debugger... – fpiette Aug 17 '21 at 16:31
  • It's usually straightforward to locate where the exception is triggered. Compile the app with Use debug DCUs set to true. Let the exception occur, select Break from the pop-up then go to View | Debug Windows | Call stack. The code which put up the exception dialog will be at the top of the list of stack entries. Look carefullyy down the list and you should be able to see which statement `Raise`d the exception – MartynA Aug 17 '21 at 17:48
  • For future reference, it is required that you provide the code in the form of a [mre] when asking debugging questions. Code out of any context that uses variables that you've not provided the declaration or initialization of in the code you posted is not usable. It would help if you would also read [ask]. – Ken White Aug 18 '21 at 00:05
  • A standard error is that the object preceding the dot does not exist. A null operator "?" as in C # we don't have in Delphi. `if(a?.PropertyOfA != foo) { /*somecode*/ }` – USauter Aug 19 '21 at 10:58

0 Answers0