tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
8
ZUGRIFFE
610
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Slater Slater ist offline Mitglied Gold
    Registriert seit
    Sep 2002
    Ort
    Bern (CH)
    Beiträge
    223
    Hy Leute,
    Habe schon wider ein Problem (Spiel). Ich erstelle Zufallszahlen von 0 bis 99. Diese speichere ich in einem Array. beim nächsten Spielzug wird wider eine neue Zufallszahl ermittelt. Wenn es Sie aber schon gibt (Im Array gespeichert), soll eine neue definiert werden (Solange bis es eine trifft, die es noch nicht gibt....
    Jedoch erhalte ich mit meinem untenstehenden Code mit der Zeit die Meldung : "System.StackOverflowException" (Kein Wunder...)

    Wie kann ich das problem sonst noch lösen?

    Bin für Anregungen Dankbar.

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    
    private void Computer()
            {
                Random();
                Kombination = zahl;
                Prüfen();
            }
    private void Random()
            {
                Random R =new Random();
                int I;
                int MaxLimit = 99;
                int MinLimit = 0;
                for(I = 0; I < 1; I++)
                {
                    zahl = R.Next(MinLimit,MaxLimit);
                }
            }
    private void Prüfen()
            {
                for (int i=0; i<100; i++)
                {
                    if (Kombinationen[i] == Kombination)
                    {
                        Computer();
                    }
                }
                       }
     
    Letztes Jahr stand meine Firma noch vor dem Abgrund.
    Dieses Jahr haben wir einen Schritt vorwärts gemacht!

  2. #2
    zovax zovax ist offline Mitglied Gold
    Registriert seit
    Jun 2004
    Ort
    Koblenz (Rheinland-Pfalz)
    Beiträge
    217
    warum machst du das ganze nicht viel kürzer?

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    
    private void Computer()
    {
         Random z  = new Random();
         Kombination = z.Next(0,99);
         foreach (int elem in Kombinationen)
         {
              if (elem  == zahl)
            {
                Computer();
            }
                    else
                    {
                            break;
                    }
         }
          ...
    }

    Wo speicherst du denn die Zahl in dem Array? in einer anderen Methode?
     

  3. #3
    Slater Slater ist offline Mitglied Gold
    Registriert seit
    Sep 2002
    Ort
    Bern (CH)
    Beiträge
    223
    Das habe ich gelöscht, als ich den Code "Sauber" ins Forum schrieb... Hier noch mal der Code:
    (Funktioniert immer noch nicht )

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    int[] Kombinationen = new int[100];
    private void Computer()
    {
         Random z  = new Random();
        Kombination = z.Next(0,99);
        foreach (int elem in Kombinationen)
        {
            if (elem  == zahl)
            {
                Computer();
            }
            else
             {
                break;
        }
        Kombinationen[Index] = Kombination;
        Index++;
    }
     
    Letztes Jahr stand meine Firma noch vor dem Abgrund.
    Dieses Jahr haben wir einen Schritt vorwärts gemacht!

  4. #4
    zovax zovax ist offline Mitglied Gold
    Registriert seit
    Jun 2004
    Ort
    Koblenz (Rheinland-Pfalz)
    Beiträge
    217
    Bei mir klappt der Code einwandfrei, mal ein paar Fragen:

    Sehe ich richtig, dass der Array "nacheinander" gefüllt wird. Wenn also die Methode Computer() aufgerufen wird, wird mithilfe der Variable Index, dem Array an der Stelle von Index ein Wert zugewiesen? Danach wird Index erhöht und neim nächsten Aufruf von Computer() wird wieder an der Stelle von Index eine Zahl hinzugefügt.

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    for (int i = 0; i < index; i++)
        {
            if (Kombinationen[i]  == zahl)
            {
                Computer();
            }
            else
             {
                break;
                     }
        }

    Damit wird dann wenigstens nicht 100mal geprüft, sondern nur so oft, wie Computer() schon aufgerufen wurde. Der Rest vom Array sollte dann ja sowieso noch nicht gefüllt sein.

    Aber wiegesagt: Bei mir klappt es einwandfrei.

    Kommt bei dem 2. Code den du versucht hattest die gleiche Fehlermeldung?
    An welcher Stelle im Code tritt den der Fehler genau auf?
     

  5. #5
    Slater Slater ist offline Mitglied Gold
    Registriert seit
    Sep 2002
    Ort
    Bern (CH)
    Beiträge
    223
    So, jetzt habe ich den Sinn des Programmes neu "gecodet".
    Wenn man auf den Button1 clickt zeichnet es aus eine Zufallsrechteck (Wenn es schon "Gezeichnet" wurde, wird eine neue Zufallszahl ermittelt...)
    Jedoch hat es eine "Fehler" drin. Kann ihn aber nicht finden
    Irgdenwie geht er plötzlich in eine Endlosschleife....
    Hänge mal den NEUEN Code an:


    Edit: Code gelöscht (falscher Code )
    Geändert von Slater (07.07.04 um 14:07 Uhr)
     
    Letztes Jahr stand meine Firma noch vor dem Abgrund.
    Dieses Jahr haben wir einen Schritt vorwärts gemacht!

  6. #6
    zovax zovax ist offline Mitglied Gold
    Registriert seit
    Jun 2004
    Ort
    Koblenz (Rheinland-Pfalz)
    Beiträge
    217
    Hm, ich sehe in dem Programm keine Zufallszahl oder etwas ähnliches und deinen 'alten'l Code auch nicht :)

    Es gibt lediglich 10 Sätze mit einer for und 10 Sätze mit einer while Schleife aus, eine Endlosschleife gibt es auch nicht.

    Vielleicht den falschen Code angehängt? :)
     

  7. #7
    Slater Slater ist offline Mitglied Gold
    Registriert seit
    Sep 2002
    Ort
    Bern (CH)
    Beiträge
    223
    ops, ja, das ist ein grosser Fehler
    Hier noch der richtige Code.
    1. Button1 -> Alle Felder leer zeichnen
    2. Button2 -> Feld berechnen & zeichnen

    Jedoch zeichnet es manchmal nichts
    Warum?

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
     
    namespace WindowsApplication8
    {
        /// <summary>
        /// Summary description for Form1.
        /// </summary>
        public class Form1 : System.Windows.Forms.Form
        {
            private System.Windows.Forms.Button button1;
            private System.Windows.Forms.PictureBox pictureBox1;
            private System.Windows.Forms.ListBox listBox1;
            private System.Windows.Forms.TextBox textBox1;
            private System.Windows.Forms.Button button2;
            private System.Windows.Forms.TextBox textBox2;
            private System.Windows.Forms.TextBox textBox3;
            private System.Windows.Forms.TextBox textBox4;
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.Container components = null;
     
            public Form1()
            {
                //
                // Required for Windows Form Designer support
                //
                InitializeComponent();
     
                //
                // TODO: Add any constructor code after InitializeComponent call
                //
            }
     
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                if( disposing )
                {
                    if (components != null) 
                    {
                        components.Dispose();
                    }
                }
                base.Dispose( disposing );
            }
     
            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.button1 = new System.Windows.Forms.Button();
                this.pictureBox1 = new System.Windows.Forms.PictureBox();
                this.listBox1 = new System.Windows.Forms.ListBox();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.button2 = new System.Windows.Forms.Button();
                this.textBox2 = new System.Windows.Forms.TextBox();
                this.textBox3 = new System.Windows.Forms.TextBox();
                this.textBox4 = new System.Windows.Forms.TextBox();
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(360, 24);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(136, 24);
                this.button1.TabIndex = 0;
                this.button1.Text = "button1";
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // pictureBox1
                // 
                this.pictureBox1.Location = new System.Drawing.Point(16, 24);
                this.pictureBox1.Name = "pictureBox1";
                this.pictureBox1.Size = new System.Drawing.Size(301, 301);
                this.pictureBox1.TabIndex = 1;
                this.pictureBox1.TabStop = false;
                // 
                // listBox1
                // 
                this.listBox1.Location = new System.Drawing.Point(360, 152);
                this.listBox1.Name = "listBox1";
                this.listBox1.Size = new System.Drawing.Size(144, 173);
                this.listBox1.TabIndex = 2;
                // 
                // textBox1
                // 
                this.textBox1.Location = new System.Drawing.Point(360, 344);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(72, 20);
                this.textBox1.TabIndex = 3;
                this.textBox1.Text = "textBox1";
                // 
                // button2
                // 
                this.button2.Location = new System.Drawing.Point(360, 64);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(136, 24);
                this.button2.TabIndex = 0;
                this.button2.Text = "button1";
                this.button2.Click += new System.EventHandler(this.button2_Click);
                // 
                // textBox2
                // 
                this.textBox2.Location = new System.Drawing.Point(328, 424);
                this.textBox2.Name = "textBox2";
                this.textBox2.Size = new System.Drawing.Size(80, 20);
                this.textBox2.TabIndex = 4;
                this.textBox2.Text = "textBox2";
                // 
                // textBox3
                // 
                this.textBox3.Location = new System.Drawing.Point(328, 456);
                this.textBox3.Name = "textBox3";
                this.textBox3.Size = new System.Drawing.Size(80, 20);
                this.textBox3.TabIndex = 4;
                this.textBox3.Text = "textBox2";
                // 
                // textBox4
                // 
                this.textBox4.Location = new System.Drawing.Point(328, 488);
                this.textBox4.Name = "textBox4";
                this.textBox4.Size = new System.Drawing.Size(80, 20);
                this.textBox4.TabIndex = 4;
                this.textBox4.Text = "textBox2";
                // 
                // Form1
                // 
                this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                this.ClientSize = new System.Drawing.Size(520, 542);
                this.Controls.Add(this.textBox2);
                this.Controls.Add(this.textBox1);
                this.Controls.Add(this.listBox1);
                this.Controls.Add(this.pictureBox1);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.textBox3);
                this.Controls.Add(this.textBox4);
                this.Name = "Form1";
                this.Text = "Form1";
                this.Load += new System.EventHandler(this.Form1_Load);
                this.ResumeLayout(false);
     
            }
            #endregion
     
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main() 
            {
                Application.Run(new Form1());
            }
            ArrayList a = new ArrayList();
            int Index=100;
            int Kombination;
            int Zahl;
            int Split1;
            int Split2;
            private void Form1_Load(object sender, System.EventArgs e)
            {
                for (int i=0; i<100; i++)
                {
                    a.Add(i);
                }
                for (int i=0; i<100; i++)
                {
                    listBox1.Items.Add(a[i]);
                }
                
            }
            private void button1_Click(object sender, System.EventArgs e)
            {
                Graphics g = pictureBox1.CreateGraphics();
                for (int c=0; c<10; c++)
                {
                    for (int i=0; i<10; i++)
                    {
                        g.DrawRectangle(new Pen(Color.Black),i*30,c*30,30,30);
                    }
                }
            }
     
            private void button2_Click(object sender, System.EventArgs e)
            {
                Berechnen();
                Zeichnen();
            }
            private void Berechnen()
            {
                Random z  = new Random();
                Kombination = z.Next(0,Index);
                Zahl = Convert.ToInt32(a[Kombination]);
                a.Remove(Kombination);
                Index--;
            }
            private void Zeichnen()
            {
                textBox1.Text = Convert.ToString(Zahl);
                listBox1.Items.Clear();
                for (int i=0; i<Index; i++)
                {
                    listBox1.Items.Add(a[i]);
                }
                if (Zahl > 9)
                {
                    Split1 = Convert.ToInt32(Convert.ToString(Zahl).Substring(0,1));
                    Split2 = Convert.ToInt32(Convert.ToString(Zahl).Substring(1));
                }
                else
                {
                    Split1 = 0;
                    Split2 = Convert.ToInt32(Convert.ToString(Zahl).Substring(0,1));
                }
                textBox2.Text = Convert.ToString(Split1);
                textBox3.Text = Convert.ToString(Split2);
                textBox4.Text = Convert.ToString(Index);
                Graphics g = pictureBox1.CreateGraphics();
                g.FillRectangle(new SolidBrush(Color.Coral),Split2*30,Split1*30,30,30);
            }
        }
    }
     
    Letztes Jahr stand meine Firma noch vor dem Abgrund.
    Dieses Jahr haben wir einen Schritt vorwärts gemacht!

  8. #8
    zovax zovax ist offline Mitglied Gold
    Registriert seit
    Jun 2004
    Ort
    Koblenz (Rheinland-Pfalz)
    Beiträge
    217
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
     
    namespace WindowsApplication8
    {
        /// <summary>
        /// Summary description for Form1.
        /// </summary>
        public class Form1 : System.Windows.Forms.Form
        {
            private System.Windows.Forms.Button button1;
            private System.Windows.Forms.PictureBox pictureBox1;
            private System.Windows.Forms.ListBox listBox1;
            private System.Windows.Forms.TextBox textBox1;
            private System.Windows.Forms.Button button2;
            private System.Windows.Forms.TextBox textBox2;
            private System.Windows.Forms.TextBox textBox3;
            private System.Windows.Forms.TextBox textBox4;
            /// <summary>
            /// Required designer variable.
            /// </summary>
            private System.ComponentModel.Container components = null;
     
            public Form1()
            {
                //
                // Required for Windows Form Designer support
                //
                InitializeComponent();
     
                //
                // TODO: Add any constructor code after InitializeComponent call
                //
            }
     
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            protected override void Dispose( bool disposing )
            {
                if( disposing )
                {
                    if (components != null) 
                    {
                        components.Dispose();
                    }
                }
                base.Dispose( disposing );
            }
     
            #region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                this.button1 = new System.Windows.Forms.Button();
                this.pictureBox1 = new System.Windows.Forms.PictureBox();
                this.listBox1 = new System.Windows.Forms.ListBox();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.button2 = new System.Windows.Forms.Button();
                this.textBox2 = new System.Windows.Forms.TextBox();
                this.textBox3 = new System.Windows.Forms.TextBox();
                this.textBox4 = new System.Windows.Forms.TextBox();
                this.SuspendLayout();
                // 
                // button1
                // 
                this.button1.Location = new System.Drawing.Point(360, 24);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(136, 24);
                this.button1.TabIndex = 0;
                this.button1.Text = "button1";
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // pictureBox1
                // 
                this.pictureBox1.Location = new System.Drawing.Point(16, 24);
                this.pictureBox1.Name = "pictureBox1";
                this.pictureBox1.Size = new System.Drawing.Size(301, 301);
                this.pictureBox1.TabIndex = 1;
                this.pictureBox1.TabStop = false;
                // 
                // listBox1
                // 
                this.listBox1.Location = new System.Drawing.Point(360, 152);
                this.listBox1.Name = "listBox1";
                this.listBox1.Size = new System.Drawing.Size(144, 173);
                this.listBox1.TabIndex = 2;
                // 
                // textBox1
                // 
                this.textBox1.Location = new System.Drawing.Point(360, 344);
                this.textBox1.Name = "textBox1";
                this.textBox1.Size = new System.Drawing.Size(72, 20);
                this.textBox1.TabIndex = 3;
                this.textBox1.Text = "textBox1";
                // 
                // button2
                // 
                this.button2.Location = new System.Drawing.Point(360, 64);
                this.button2.Name = "button2";
                this.button2.Size = new System.Drawing.Size(136, 24);
                this.button2.TabIndex = 0;
                this.button2.Text = "button1";
                this.button2.Click += new System.EventHandler(this.button2_Click);
                // 
                // textBox2
                // 
                this.textBox2.Location = new System.Drawing.Point(328, 424);
                this.textBox2.Name = "textBox2";
                this.textBox2.Size = new System.Drawing.Size(80, 20);
                this.textBox2.TabIndex = 4;
                this.textBox2.Text = "textBox2";
                // 
                // textBox3
                // 
                this.textBox3.Location = new System.Drawing.Point(328, 456);
                this.textBox3.Name = "textBox3";
                this.textBox3.Size = new System.Drawing.Size(80, 20);
                this.textBox3.TabIndex = 4;
                this.textBox3.Text = "textBox2";
                // 
                // textBox4
                // 
                this.textBox4.Location = new System.Drawing.Point(328, 488);
                this.textBox4.Name = "textBox4";
                this.textBox4.Size = new System.Drawing.Size(80, 20);
                this.textBox4.TabIndex = 4;
                this.textBox4.Text = "textBox2";
                // 
                // Form1
                // 
                this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
                this.ClientSize = new System.Drawing.Size(520, 542);
                this.Controls.Add(this.textBox2);
                this.Controls.Add(this.textBox1);
                this.Controls.Add(this.listBox1);
                this.Controls.Add(this.pictureBox1);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.textBox3);
                this.Controls.Add(this.textBox4);
                this.Name = "Form1";
                this.Text = "Form1";
                this.Load += new System.EventHandler(this.Form1_Load);
                this.ResumeLayout(false);
     
            }
            #endregion
     
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main() 
            {
                Application.Run(new Form1());
            }
            ArrayList a = new ArrayList();
            int Index=100;
            int Kombination;
            int Zahl;
            int Split1;
            int Split2;
            private void Form1_Load(object sender, System.EventArgs e)
            {
                for (int i=0; i<100; i++)
                {
                    a.Add(i);
                }
                for (int i=0; i<100; i++)
                {
                    listBox1.Items.Add(a[i]);
                }
                
            }
            private void button1_Click(object sender, System.EventArgs e)
            {
                Graphics g = pictureBox1.CreateGraphics();
                for (int c=0; c<10; c++)
                {
                    for (int i=0; i<10; i++)
                    {
                        g.DrawRectangle(new Pen(Color.Black),i*30,c*30,30,30);
                    }
                }
            }
     
            private void button2_Click(object sender, System.EventArgs e)
            {
                Berechnen();
                Zeichnen();
            }
            private void Berechnen()
            {
                Random z  = new Random();
                Kombination = z.Next(0,Index);
                Zahl = Convert.ToInt32(a[Kombination]);
                [B]a.RemoveAt[/B](Kombination);
                Index--;
            }
            private void Zeichnen()
            {
                textBox1.Text = Convert.ToString(Zahl);
                listBox1.Items.Clear();
                for (int i=0; i<Index; i++)
                {
                    listBox1.Items.Add(a[i]);
                }
                if (Zahl > 9)
                {
                    Split1 = Convert.ToInt32(Convert.ToString(Zahl).Substring(0,1));
                    Split2 = Convert.ToInt32(Convert.ToString(Zahl).Substring(1));
                }
                else
                {
                    Split1 = 0;
                    Split2 = Convert.ToInt32(Convert.ToString(Zahl).Substring(0,1));
                }
                textBox2.Text = Convert.ToString(Split1);
                textBox3.Text = Convert.ToString(Split2);
                textBox4.Text = Convert.ToString(Index);
                Graphics g = pictureBox1.CreateGraphics();
                g.FillRectangle(new SolidBrush(Color.Coral),Split2*30,Split1*30,30,30);
            }
        }
    }

    RemoveAt, weil wenn du eine Zahl mit Remove aus dem Array entfernst, verschieben sich die darüber liegenden eben um eine Stelle. Wenn 56 enfernt wurde ist Zahl 57 an Platz 56, usw :)
     

  9. #9
    Slater Slater ist offline Mitglied Gold
    Registriert seit
    Sep 2002
    Ort
    Bern (CH)
    Beiträge
    223
    Danke, funktioniert super
     
    Letztes Jahr stand meine Firma noch vor dem Abgrund.
    Dieses Jahr haben wir einen Schritt vorwärts gemacht!

Ähnliche Themen

  1. Zufallszahl
    Von lz9c1j im Forum C/C++
    Antworten: 7
    Letzter Beitrag: 21.12.04, 09:18
  2. Zufallszahl in C++
    Von micweg im Forum C/C++
    Antworten: 5
    Letzter Beitrag: 20.10.04, 10:25
  3. Zufallszahl
    Von dwiist im Forum PHP
    Antworten: 7
    Letzter Beitrag: 29.01.04, 09:50
  4. Zufallszahl zw. 11 u. 7
    Von pulmoll im Forum Flash Plattform
    Antworten: 5
    Letzter Beitrag: 16.01.04, 14:35
  5. Zufallszahl
    Von guigui im Forum Flash Plattform
    Antworten: 1
    Letzter Beitrag: 31.07.01, 10:48