Exception

Résolu
xelr90 Messages postés 16 Date d'inscription dimanche 15 août 2004 Statut Membre Dernière intervention 20 août 2004 - 18 août 2004 à 10:24
cs_Crazyht Messages postés 1522 Date d'inscription mardi 18 décembre 2001 Statut Membre Dernière intervention 21 août 2010 - 19 août 2004 à 14:02
Je débute en C# et j'ai des probleme...
J'essaye de crée un petit morpion mais pour l'instant je n'ai que crée la fenetre winforms avec des checkBox mais ce code génere une erreur :

using System;
using System.Windows.Forms;
using System.Drawing;

namespace DefaultNamespace
{
/// <summary>
/// Description of MainForm.
/// </summary>
public class MainForm : System.Windows.Forms.Form
{
const int nb_CB = 9;
CheckBox[] box= new CheckBox[nb_CB];

public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();

initCB();
}

private void initCB()
{
for(int i=0 ; i<=9 ; i++)
{
this.box[i] = new CheckBox();
this.box[i].Name = i.ToString();
this.box[i].Size = new System.Drawing.Size(24,24);
this.box[i].Text = "";
this.box[i].Click += new EventHandler(checkBox_Click);
}
this.box[0].Location = new Point(10,10);
this.box[1].Location = new Point(10,35);
this.box[2].Location = new Point(10,60);
this.box[3].Location = new Point(35,10);
this.box[4].Location = new Point(35,35);
this.box[5].Location = new Point(35,60);
this.box[6].Location = new Point(60,10);
this.box[7].Location = new Point(60,35);
this.box[8].Location = new Point(60,60);
this.Controls.AddRange( box );
}

private void activerCheckBox()
{
for(int i=0; i<nb_CB; i++)
{
this.box[i].Enabled = true;
this.box[i].Checked = false;
}
}

private void checkBox_Click(object sender, EventArgs ea)
{
CheckBox cb = (CheckBox) sender;
}

[STAThread]
public static void Main(string[] args)
{
Application.Run(new MainForm());
}

#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(392, 316);
this.MaximizeBox = false;
this.Name = "MainForm";
this.Text = "morpion";
this.ResumeLayout(false);
}

#endregion
public void ButtonClick(object sender, System.EventArgs e)
{
activerCheckBox();
}
}
}

C'est quoi le problème?

3 réponses

cs_Crazyht Messages postés 1522 Date d'inscription mardi 18 décembre 2001 Statut Membre Dernière intervention 21 août 2010 8
19 août 2004 à 14:02
Dans InitCB :

for(int i=0 ; i<9 ; i++)

au lieu de :
for(int i=0 ; i<=9 ; i++)

A++

:-p Crazyht :)
MVP Visual C#.NET

[Admin Codes-Sources]
[Membre Developer-Association]
3
cs_Crazyht Messages postés 1522 Date d'inscription mardi 18 décembre 2001 Statut Membre Dernière intervention 21 août 2010 8
18 août 2004 à 10:55
C'est quoi l'erreur ?

A++

:-p Crazyht :)
MVP Visual C#.NET

[Admin Codes-Sources]
[Membre Developer-Association]
0
xelr90 Messages postés 16 Date d'inscription dimanche 15 août 2004 Statut Membre Dernière intervention 20 août 2004
18 août 2004 à 11:14
messege d'erreur lors de l'excution :

Application has generate an exception taht could not be handled

Process id=0xffe01e33(-2089421), Thread id=0fffd6017(-172009).

Click OK to cancel the application
Click Cancel to debug the application

je clique ok ca se ferme et si je clique cancel :
nouveau message d'errreur :

Regsiter JIT debuggeur is not available. An attemp to launch a JIT debugguer with the following command resulted in an error code of 0x2 (2). Please check computer settings.

corbg.exe !a0xffe01e33

Click retry to have the prossec wait while attaching a debugguer manually
Click Cancel to abort the JIT debug request

si je clique retry le message derreur se ferme rien ne se passe mais l'app est toujours en coursd'execution et si je clique cancel le message derreur se ferme lapp aussi et rien ne se passe!

AIDEZ MOI
0
Rejoignez-nous