Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

tach

hab da ma nen problem und zwar bei delphi hab ich ein programm geschrieben was soweit ok ist und funktionieren würde aber wenn ich es starten will sagt er mir "im projekt bla bla ist eine exception der klasse EConvert error aufgetreten . meldung: ' " ist kein gültiger integerwert' . " und dann geht nüscht mehr. ich hab aber nirgenswo anführungszeichen in meiner unit drin. und nu?

ob ichs mache? naja meinetwegen

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

StdCtrls, Grids;

type

TForm1 = class(TForm)

StringGrid1: TStringGrid;

Label1: TLabel;

Edit1: TEdit;

Button1: TButton;

Button2: TButton;

procedure Button2Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

private

{ Private-Deklarationen }

public

{ Public-Deklarationen }

end;

var

Form1: TForm1;

x,i:integer;

implementation

{$R *.DFM}

procedure TForm1.Button2Click(Sender: TObject);

begin

close;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

stringgrid1.cells[1,0]:='Name';

stringgrid1.cells[2,0]:='Vorname';

stringgrid1.cells[3,0]:='Punkte';

stringgrid1.cells[4,0]:='Prozente';

stringgrid1.cells[5,0]:='Note';

stringgrid1.cells[0,1]:='1';

stringgrid1.cells[0,2]:='2';

stringgrid1.cells[0,3]:='3';

stringgrid1.cells[0,4]:='4';

For i:=1 To StringGrid1.rowcount-1 Do

begin

x:=round((strtoint(stringgrid1.Cells[3,i])/25)*100);

stringgrid1.cells[4,i]:=inttostr(x)+'%';

case x of

0..12:stringgrid1.cells[5,i]:='6';

13..22:stringgrid1.cells[5,i]:='5-';

23..32:stringgrid1.cells[5,i]:='5';

33..42:stringgrid1.cells[5,i]:='5+';

43..48:stringgrid1.cells[5,i]:='4-';

49..54:stringgrid1.cells[5,i]:='4';

55..60:stringgrid1.cells[5,i]:='4+';

61..65:stringgrid1.cells[5,i]:='3-';

66..70:stringgrid1.cells[5,i]:='3';

71..75:stringgrid1.cells[5,i]:='3+';

76..80:stringgrid1.cells[5,i]:='2-';

81..85:stringgrid1.cells[5,i]:='2';

86..91:stringgrid1.cells[5,i]:='2+';

92..95:stringgrid1.cells[5,i]:='1-';

96..99:stringgrid1.cells[5,i]:='1';

100:stringgrid1.cells[5,i]:='1+';

end;

end;

end;

end.

hat was mit noten und prozente zu tun...schule halt

Dein Fehler liegt in der folgenden Zeile

x:=round((strtoint(stringgrid1.Cells[3,i])/25)*100);
Und zwar ist im Feld stringgrid1.Cells[3,i] nichts eingetragen und dieses nichts soll in einen Integerwert umgewandelt werden. Das funktioniert nicht. Trägst du vorher etwas ein, wie :


begin

stringgrid1.Cells[3,i]:='25';

x:=round((strtoint(stringgrid1.Cells[3,i])/25)*100);

...

dann geht etwas.

was hatn eigentlich das round zu bedeuten? also bei x:=round(( bla...) und:

For i:=1 To StringGrid1.rowcount-1 Do

dieses rowcount-1 !? was rowcount is weiß ich aber warum minus 1??

was hatn eigentlich das round zu bedeuten?

Die Werte die ins Grid eingetragen werden werden gerundet. Round rundet immer auf den nächsten ganzzahligen Wert.

Kleiner Tip dazu: Geh mal mit dem Cursor im Quelltext auf "round" und drück F1;)

dieses rowcount-1 !? was rowcount is weiß ich aber warum minus 1??

Rowcount gibt die Anzahl der Zeilen an. Der Zeilenindex beginnt aber bei 0. Wenn Du jetzt die Zeilen bis Rowcount durchlaufen lässt, gibt es eine Fehlermeldung die dir eine Indexüberschreitung ankreidet, weil der Index ja immer um 1 kleiner ist als Rowcount.

Original geschrieben von cosi

x:=round((strtoint(stringgrid1.Cells[3,i])/25)*100);

Verwende anstatt strToInt strToIntDef, das ist sicherer.

z.B.

x:=round((strtointDef(stringgrid1.Cells[3,i],0)/25)*100);

In diesem Fall wird als Integerwert 0 angenommen, falls der String nicht umgewandelt werden kann. Den Defaultwert kannst du natürlich selbst wählen, schau einfach mal in der Hilfe nach.

danke schön erstmal für eure hilfe! =)

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.