[Delphi] Variabele identifiers

Pagina: 1
Acties:
  • 32 views sinds 30-01-2008

  • cypher21
  • Registratie: November 2001
  • Laatst online: 09-02 10:02
ik heb een form met daarin een stuk of 30 comboboxen. ze heten respectivelijk cmbpart1 tot en met 30.

nu moet ik hier de invoer van controleren met een if-statement. ik heb de search gebruikt, maar kon et niet vinden.
ik heb de volgende code:
code:
1
2
3
4
5
6
7
8
9
 for I := 1 to strtoint(CmbNumOfDisks.Items[CmbNumOfDisks.ItemIndex]) do
    begin
    ini.WriteString('Disk'+inttostr(i)+'.config','Wipedisk','Yes');
      if (CmbPart1.Items[CmbPart1.ItemIndex] > 1) then
        ini.WriteString('Disk'+inttostr(i)+'.config','Size'+inttostr(i),'*');
        ini.WriteString('Disk'+inttostr(i)+'.config','Partitiontype'+inttostr(i),'Yes');
        ini.WriteString('Disk'+inttostr(i)+'.config','Quickformat'+inttostr(i),'Yes');
      end;
    end;


nu is de bedoeling dat dit sukkie gebruikt word voor alle 30 comboboxen. dus de identifier CmbPart1 moet variabel worden. Kan iemand mij vertellen hoe ik dat doe? want delphi begint te drammen over undeclared identifiers

thx

"me" is geen bezittelijk voornaamwoord! Terug naar de basisschool!


  • Paul
  • Registratie: September 2000
  • Laatst online: 19-08 15:39
function FindComponent(const AName: string): TComponent;

Description

FindComponent returns the component in the Components property array with the name that matches the string in the AName parameter. Use FindComponent to determine whether a given component is owned by another.
doet precies wat jij wilt :)

De TComponent moet je nog wel even asen of casten maar dat mag geen probleem zijn :)

"Your life is yours alone. Rise up and live it." - Richard Rahl
Rhàshan - Aditu Sunlock


  • curry684
  • Registratie: Juni 2000
  • Laatst online: 13-08 16:46

curry684

left part of the evil twins

Lees de helpfiles eens :)

Als FindComponent het niet helemaal is voor jou kun je hetzelfde resultaat ook nog met ClassName, InheritsFrom, ComponentCount, Components, Controls en/of ControlCount bereiken. Deze vraag komt hier trouwens ook 2~3 keer per maand langs ;)

ja tijd voor een FAQ-entry, I know :Y)

Professionele website nodig?


Dit topic is gesloten.