Autor Beitrag
nabralanca
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Mi 04.02.09 15:12 
Und hier kommt mein nächstes problem:
ich übergeben meinem programm eine vorher unbekannte zahl.
Genausovile labels soll es auf einem fenster erstellen:
bsp: ich sga ihm 5 labels, und er generiert mit 5 labels untereinaner.


wie kann man das machen???
bakachan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 503
Erhaltene Danke: 34

W7 (x64) Ultimate
C# / VB.NET (VS2010 Ultimate)
BeitragVerfasst: Mi 04.02.09 15:19 
Da die Frage so aussagekräftig gestellt wurde hier eine genauso aussagekräftige Antwort:
Mit einer Schleife.
nabralanca Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Mi 04.02.09 15:27 
ja soweit bin ich auch schon gekommen^^

nur mag das nicht
bis jetzt sieht mein programm so aus:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
int i;            
For(i=0; i<anzahl;i++)
            {
                Label label1 = new Label();
                label1.AutoSize = true;
                label1.Location = new System.Drawing.Point(10549);
                label1.Name = "label1";
                label1.Size = new System.Drawing.Size(i+3513);
                label1.TabIndex = 0;
                label1.Text = "label1";
            }

wobei i nur die schleifenzählt und anzahl die anzahl der labels ist, die ich will

bei mir entsteht immer nur 1 label

Moderiert von user profile iconChristian S.: C#-Tags hinzugefügt
bakachan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 503
Erhaltene Danke: 34

W7 (x64) Ultimate
C# / VB.NET (VS2010 Ultimate)
BeitragVerfasst: Mi 04.02.09 15:36 
1. Bitte C#-CodeTags verwenden damit der Code besser lesbar wird.
2. Du fügst deine Labels nirgendswo dem Form hinzu.(form.Controls.Add)
3. Du setzt jedes Label an die gleiche Location. (verdeckung)
nabralanca Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Mi 04.02.09 19:41 
jetzt gehts