GESTION D'UN MAGASIN DE MEUBLES

MorpionMx Messages postés 3466 Date d'inscription lundi 16 octobre 2000 Statut Membre Dernière intervention 30 octobre 2008 - 9 déc. 2007 à 21:17
 azer - 25 mai 2015 à 21:24
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/44996-gestion-d-un-magasin-de-meubles

tres bien
nouri2525 Messages postés 1 Date d'inscription mardi 9 juin 2009 Statut Membre Dernière intervention 19 octobre 2012
19 oct. 2012 à 22:04
comment pui-je ouvrir ce fichier
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
19 déc. 2007 à 20:57
bon j'ai enlever le -1 mais suis ps sur que ce soit une super idéé mais ca marche lol

il sert a quoi le -1 dans
facturesData = new FactureData[(this.panel2.Controls.Count - 1)];
String result = "";

for (int i = 0; i < this.panel2.Controls.Count-1; i++)

sinon je ne comprends pas comment récupere les nom des txtbox genere ... et comment y integrer betement la valeur quantité...
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
14 déc. 2007 à 15:39
waou merci bcp hier soir me suis pris la tete a essayer d'imaginer une methode lol mais comme on dit chacun son boulot lol je n'arriver meme pas a avoir un debut de resonnement lol

j'ai essayer le code par contre il me dit qd je clique sur ajouter

L'exception System.OverflowException n'a pas été gérée
Message="L'opération arithmétique a provoqué un dépassement de capacité."
Source="GestionMeublesFamavieAngelZ"
StackTrace:
à GestionFamavie.factures.Values() dans C:\Users\AngelZ\Documents\Visual Studio 2005\Projects\GestionMeublesFamavieAngelZ\GestionMeublesFamavieAngelZ\factures.cs:ligne 325
à GestionFamavie.factures.ComponementFacture() dans C:\Users\AngelZ\Documents\Visual Studio 2005\Projects\GestionMeublesFamavieAngelZ\GestionMeublesFamavieAngelZ\factures.cs:ligne 313
à GestionFamavie.factures.Add_Click(Object sender, EventArgs e) dans C:\Users\AngelZ\Documents\Visual Studio 2005\Projects\GestionMeublesFamavieAngelZ\GestionMeublesFamavieAngelZ\factures.cs:ligne 223
à System.Windows.Forms.Control.OnClick(EventArgs e)
à System.Windows.Forms.Button.OnClick(EventArgs e)
à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
à System.Windows.Forms.Control.WndProc(Message& m)
à System.Windows.Forms.ButtonBase.WndProc(Message& m)
à System.Windows.Forms.Button.WndProc(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
à System.Windows.Forms.Application.Run(Form mainForm)
à WindowsApplication1.Program.Main() dans C:\Users\AngelZ\Documents\Visual Studio 2005\Projects\GestionMeublesFamavieAngelZ\GestionMeublesFamavieAngelZ\Program.cs:ligne 17
à System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
à System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
à System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()


c a ce niveau la "facturesData = new FactureData[(this.panel2.Controls.Count - 1)];"

pour ma part le -1 me semble bizarre mais bon vu mes competence lol
g essaye de remplacer par +1 mais ca marche pas meiux lol

ps tu es vraiment super sympa
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
14 déc. 2007 à 11:18
Et hop ( il en fin de code une classe suplémentaire destinée aux données et une fonction values... à adapter selon ton besoin!!

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GestionFamavie
{
public partial class factures : Form
{
public factures()
{
InitializeComponent();
}

private void factures_Load(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source = C:\Documents and Settings\BoZZ\Bureau\csharpfr_GESTION-MAGASIN-MEUBLES___Page\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs1;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from info_famavie;", conn);

rs1 = comm.ExecuteReader();

while (rs1.Read())
{

nomC1.Text = rs1["societe"].ToString();
tvaC1.Text = rs1["tva"].ToString();
compteC1.Text = rs1["compte"].ToString();
telC1.Text = rs1["tel"].ToString();
adresseC1.Text = rs1["adresse"].ToString();
cpC1.Text = rs1["cp"].ToString();
villeC1.Text = rs1["ville"].ToString();
paysC1.Text = rs1["pays"].ToString();
mailC1.Text = rs1["mail"].ToString();
siteC1.Text = rs1["site"].ToString();

}
rs1.Close();

System.Data.OleDb.OleDbDataReader rs2;
System.Data.OleDb.OleDbCommand comm1 = new System.Data.OleDb.OleDbCommand("select * from client;", conn);
rs2 = comm1.ExecuteReader();
while (rs2.Read())
{
ccodeC1client.Items.Add(rs2["codeC"].ToString());
}
rs2.Close();

System.Data.OleDb.OleDbDataReader rs3;
System.Data.OleDb.OleDbCommand comm3 = new System.Data.OleDb.OleDbCommand("select * from produits;", conn);
rs3 = comm3.ExecuteReader();
while (rs3.Read())
{
refprodstockC1.Items.Add(rs3["codeP"].ToString());
refprodcommandeC1.Items.Add(rs3["codeP"].ToString());
refprodreserveC1.Items.Add(rs3["codeP"].ToString());
}
rs3.Close();

}

}

private void TabConsultation_Click(object sender, EventArgs e)
{

}

private void groupBox1_Enter(object sender, EventArgs e)
{

}

private void label6_Click(object sender, EventArgs e)
{

}

private void b_Valider_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source = C:\Documents and Settings\BoZZ\Bureau\csharpfr_GESTION-MAGASIN-MEUBLES___Page\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from client where codeC='" + ccodeC1client.Text + "'", conn);
rs = comm.ExecuteReader();
while (rs.Read())
{

nomC1client.Text = rs["Nom"].ToString();
prenomC1client.Text = rs["Prenom"].ToString();
tvaC1client.Text = rs["tva"].ToString();
adresseC1client.Text = rs["adresse"].ToString();
telephoneC1client.Text = rs["tel"].ToString();
mailC1client.Text = rs["mail"].ToString();
cpC1client.Text = rs["cp"].ToString();
villeC1client.Text = rs["ville"].ToString();
paysC1client.Text = rs["pays"].ToString();

}
rs.Close();
}
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void b_ajouter_Click(object sender, EventArgs e)
{
if (ccodeC1client.Text != "" && nomC1client.Text != "" && prenomC1client.Text != "")
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();

conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source = C:\Documents and Settings\BoZZ\Bureau\csharpfr_GESTION-MAGASIN-MEUBLES___Page\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
int r;
System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("INSERT INTO Client(codeC,Nom,Prenom,tva,adresse,tel,mail,cp,ville,pays) VALUES('" + ccodeC1client.Text + "','" + nomC1client.Text + "','" + prenomC1client.Text + "','" + tvaC1client.Text + "','" + adresseC1client.Text + "','" + telephoneC1client.Text + "','" + mailC1client.Text + "','" + cpC1client.Text + "','" + villeC1client.Text + "','" + paysC1client.Text + "');", conn);
r = command.ExecuteNonQuery();
MessageBox.Show("Operation d'ajout reussie");
//Indication f = new Indication();
//f.Show();
}
}
else
{ //MessageBox.Show ("Certains Champs sont vides");
Erreur001 f = new Erreur001();
f.Show();
}
}

private void button4_Click(object sender, EventArgs e)
{
this.Hide();
}

private void label32_Click(object sender, EventArgs e)
{

}

private void nom_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
{

}

private void groupBox5_Enter(object sender, EventArgs e)
{

}

private void datestockC1_TextChanged(object sender, EventArgs e)
{

}

private void textBox8_TextChanged(object sender, EventArgs e)
{

}

private void modelfactC1_TextChanged(object sender, EventArgs e)
{

}

private void panel2_Paint(object sender, PaintEventArgs e)
{

}

private void Add_Click(object sender, EventArgs e)
{
Panel panelComponementFacture = ComponementFacture(); // creation de l'objet panel avec textbox
this.panel2.Controls.Add(panelComponementFacture);// ajout du panel avec textbox au panel cible
panelComponementFacture.BringToFront();//pour avoir un empilement correctement hierarchisé des panel ajouté

}

private void qtfact1_TextChanged(object sender, EventArgs e)
{

}

private Panel ComponementFacture()
{

System.Windows.Forms.Panel panel;
System.Windows.Forms.TextBox fournisseurfact1;
System.Windows.Forms.TextBox prixfact1;
System.Windows.Forms.TextBox couleurfact1;
System.Windows.Forms.TextBox modelfact1;
System.Windows.Forms.TextBox typefact1;
System.Windows.Forms.TextBox qtfact1;

panel = new System.Windows.Forms.Panel();
fournisseurfact1 = new System.Windows.Forms.TextBox();
prixfact1 = new System.Windows.Forms.TextBox();
couleurfact1 = new System.Windows.Forms.TextBox();
modelfact1 = new System.Windows.Forms.TextBox();
typefact1 = new System.Windows.Forms.TextBox();
qtfact1 = new System.Windows.Forms.TextBox();
panel.SuspendLayout();
SuspendLayout();
//
// panel
//
panel.Controls.Add(fournisseurfact1);
panel.Controls.Add(prixfact1);
panel.Controls.Add(couleurfact1);
panel.Controls.Add(modelfact1);
panel.Controls.Add(typefact1);
panel.Controls.Add(qtfact1);
panel.Location = new System.Drawing.Point(36, 77);
panel.Name = "panelA" + this.panel2.Controls.Count.ToString();
panel.Size = new System.Drawing.Size(512, 27);
panel.TabIndex = 0;
//
// fournisseurfact1
//
fournisseurfact1.Location = new System.Drawing.Point(338, 3);
fournisseurfact1.Name = "fournisseurfactB" + this.panel2.Controls.Count.ToString();
fournisseurfact1.Size = new System.Drawing.Size(80, 20);
fournisseurfact1.TabIndex = 159;
//
// prixfact1
//
prixfact1.Location = new System.Drawing.Point(421, 3);
prixfact1.Name = "prixfactC" + this.panel2.Controls.Count.ToString();
prixfact1.Size = new System.Drawing.Size(84, 20);
prixfact1.TabIndex = 158;
//
// couleurfact1
//
couleurfact1.Location = new System.Drawing.Point(283, 3);
couleurfact1.Name = "couleurfactD" + this.panel2.Controls.Count.ToString();
couleurfact1.Size = new System.Drawing.Size(52, 20);
couleurfact1.TabIndex = 157;
//
// modelfact1
//
modelfact1.Location = new System.Drawing.Point(95, 3);
modelfact1.Name = "modelfactE" + this.panel2.Controls.Count.ToString();
modelfact1.Size = new System.Drawing.Size(184, 20);
modelfact1.TabIndex = 156;
//
// typefact1
//
typefact1.Location = new System.Drawing.Point(30, 3);
typefact1.Name = "typefactF" + this.panel2.Controls.Count.ToString();
typefact1.Size = new System.Drawing.Size(62, 20);
typefact1.TabIndex = 155;
//
// qtfact1
//
qtfact1.Location = new System.Drawing.Point(3, 3);
qtfact1.Name = "qtfactG" + this.panel2.Controls.Count.ToString();
qtfact1.Size = new System.Drawing.Size(25, 20);
qtfact1.TabIndex = 154;

panel.Dock = DockStyle.Top ;
panel.BringToFront();

Values();

return panel;



}

private FactureData[] facturesData;

private void Values()
{
facturesData = new FactureData[(this.panel2.Controls.Count - 1)];

String result = "";

for (int i = 0; i < this.panel2.Controls.Count-1; i++)
{
facturesData[i] = new FactureData();
facturesData[i].Qt = this.panel2.Controls[i].Controls[5].Text ;
facturesData[i].Type = this.panel2.Controls[i].Controls[4].Text;
facturesData[i].Descriptif = this.panel2.Controls[i].Controls[3].Text;
facturesData[i].Couleur = this.panel2.Controls[i].Controls[2].Text;
facturesData[i].Fournisseur = this.panel2.Controls[i].Controls[1].Text;
facturesData[i].PrixTVAC = this.panel2.Controls[i].Controls[0].Text;
}

foreach (FactureData factureData in facturesData)
{
result += " Qt :" + factureData.Qt;
result += " Type :" + factureData.Type;
result += " Descriptif :" + factureData.Descriptif;
result += " Couleur :" + factureData.Couleur;
result += " Fournisseur :" + factureData.Fournisseur;
result += " PrixTVAC :" + factureData.PrixTVAC + "\r\n";

}

MessageBox.Show(result);
}
}

public class FactureData
{

private String _Qt;

public String Qt
{
get { return _Qt; }
set { _Qt = value; }
}
private String _Type;

public String Type
{
get { return _Type; }
set { _Type = value; }
}
private String _Descriptif;

public String Descriptif
{
get { return _Descriptif; }
set { _Descriptif = value; }
}
private String _Couleur;

public String Couleur
{
get { return _Couleur; }
set { _Couleur = value; }
}
private String _Fournisseur;

public String Fournisseur
{
get { return _Fournisseur; }
set { _Fournisseur = value; }
}
private String _PrixTVAC;

public String PrixTVAC
{
get { return _PrixTVAC; }
set { _PrixTVAC = value; }
}

}

}
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
13 déc. 2007 à 19:32
non je bosse dans l info mais suis gestionnaire reseaux (certifier cisco :) ) et la programmation c pas trop mon dada :)

je fais juste ca pour aider mon beau pere en fait (important de bien passer dasn sa belle fammille lol)

je dois t'avouer que je comprends pas le quart de la moitier de se que tu a ecrit, mais j'ai lu vite, je n'ai pas bcp de tps la mais je m y pencherai ce soir plus pronfondement :)

je sens que je vais encore avoir mal la tete cette nuit, ca commence a me lourder ce projet mdr je vais finir par le faire en php si ca continue lol

en tout ca merci pour ton aide
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
13 déc. 2007 à 18:52
C'est à toi d'être en peu plus percévérant que cela ,je t'avouerai qu'il me faudrait 1 ou 2 heures pour réaliser ce que tu souhaite ( pour un spécifique bien clean).

L'idée général se centre sur la reconnaissance des objets cad la propriété name de chaque nouvel objet.
Seulement il sont créés dynamiquement cad à l'execution du code et dans ce cas selon les actions de l'utilisateur.

Cette analyse nous offre les différentes possibilité de réalisation , voilà c tout !!!!

.
.
.
.

Ok je ne te laisse pas avec ça, tu va me maudire :)

/1 la propriété NAME :

Le code que je t'ai fournit n'est pas complètement propre , l'identification est du style :

prixfact1.Name = "prixfact1" + this.panel2.Controls.Count.ToString();

cela fournit les nom suivant : prixfact11 , prixfact12 , prixfact13 , prixfact14 .... etc aucunement fonctionnel.

on peut par exemple le faire avec une grille style jeu d'échec : prixfactA0 , prixfactA1 , ... , prixfactA9,prixfactB0,prixfactB1,.....etc cela nous la taille de cette grille et assez large au vu du nombre de textbox sur une ligne et du nombre de ligne (la grille max est 26*10).

Pour info je fait mon raisonnement indépendament de l'objectif de mon programme , je répond simplement est de manière la plus juste.(c'est une notion importante , en POO par exemple).

à toi de faire : une methode qui renvoie le chiffre correspondant au nombre de lignes actuellement inseré + 1 (attention on insère la ligne supplementaire).
pour la lettre c'est statique vu que le nombre de texte box est toujours le meme ;la creation de chaque textbox est réalisé dans le code (ComponementFacture())

====> La première etape est effectué.

plusieurs possibilité maintenant :

2/"Le code est créé dynamiquement" : il existe une façon de programmer (vraiment top) par metaprogrammation. Avec le principe de Reflexion , cad utiliser la capcité de C# à s'auto anlayser et programmer....

3/"selon les actions de l'utilisateur" : tout de suite on pense aux evenements , ici ce sont les changements de texte des textbox , à chaque fois qu'on modifie une texte box on renseigne une variable correspondante avec la valeur (encore mieux dans une classe dédié à ces valeurs).
On fini en utilisant ces "variables" dans les methods spécifiques aux besoins.

4/ Directement avec une fonction qui boucle (il faut deux boucles , tableau à 2 dimensions ) sur toute les textboxs , on remplit nos variables (ou mieux une classe spécifique). Les bornes des boucles peuvent être définie en amont à la création des textbox , par exemple !!!

La solution 2/ demande une très bonne expèrience , elle est utilisé pour des application modulaire , ne te lance pas dans cela , il te faudrat beaucoup de temps avant d'arrivé à l'objectif voulu.Je te souhaite d'avoir un jour l'experience de pouvoir programmer comme cela ....
La solution 3/ demande plus d'expèrience , l'avantage c'est la rapidité d'exécution ...
dans quelque mois tu pourras le faire.
La solution 4/ est celle que je te conseille de faire .Concentre toi donc sur le point 1/ et le point 4/.

Pour conclure il te faut faire : une fonction qui nomme les lignes , modifier la fonction ComponementFacture() pour nommer correctement les Names des textbox. Puis une fonction qui réalise un bouclage sur tout les textbox dont tu à besoin et qui effectue le traitement. Cela va te demander , de la minutie , car il faut boucler sur les controls du panel2 (cad la propriete panel2.Coontrols , on accède aux control comme cela : panel2.controls[i] , la deuxieme boucle sur le panel en cours de la même façon que précédement. (Attention les controles sont inseré en sens inverse ).... vas y a par tatonnement avec des BreakPoint , c'est un super exercirce.

Voilà Mr , je pense qu'il y ici une bonne analyse de la situation et de ce qu'il y à faire.

Pour la rédaction , j'ai mon linge à tendre, je permet de t'envoyer ce commentaire , sans le relire , ça me semble relativement clair.

Sur ceux, bon code ... essaye de te débrouiller avec ce post (je pense que tu devrais y arriver en 1 ou 2 jours) :)

PS : Une question , es tu etudiant , dans la profession ou accroc à l'info ?

Voici les differentes possibilités :
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
13 déc. 2007 à 16:38
voila g modifier mon code mais la je commence a me dire que je n'ai pas les comp necessaire pour le finir tout seul :)

premiere question comment recuperer les nom des textbox cree dynamiquement pour mettre les valeur dans une table "facture" ?

comment faire en sorte que lorsque je clique sur ajouter dans les 2 txtbox "commande" et "reservé" cela s'ajoute dans les table corresepondante 'commande' et 'reserve' ? g essayer mais suis pas sur surtout que normalement ds ses 2 tables il y a pour 'commande' un codeC qui ne se genere pas automatiquement donc je devrait reprendre le num de la derniere commande et faire +1 idem pour reserve...

enfin voici le code peut etre que tu pourra encore une fois m'aider, franchement merci bcp tu me sauve la vie et tu es tres patient lol


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GestionFamavie
{
public partial class factures : Form
{
public factures()
{
InitializeComponent();

}

private void factures_Load(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs1;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from info_famavie;", conn);

rs1 = comm.ExecuteReader();

while (rs1.Read())
{

nomC1.Text = rs1["societe"].ToString();
tvaC1.Text = rs1["tva"].ToString();
compteC1.Text = rs1["compte"].ToString();
telC1.Text = rs1["tel"].ToString();
adresseC1.Text = rs1["adresse"].ToString();
cpC1.Text = rs1["cp"].ToString();
villeC1.Text = rs1["ville"].ToString();
paysC1.Text = rs1["pays"].ToString();
mailC1.Text = rs1["mail"].ToString();
siteC1.Text = rs1["site"].ToString();



}
rs1.Close();

System.Data.OleDb.OleDbDataReader rs2;
System.Data.OleDb.OleDbCommand comm1 = new System.Data.OleDb.OleDbCommand("select * from client;", conn);
rs2 = comm1.ExecuteReader();
while (rs2.Read())
{
ccodeC1client.Items.Add(rs2["codeC"].ToString());
}
rs2.Close();

System.Data.OleDb.OleDbDataReader rs3;
System.Data.OleDb.OleDbCommand comm3 = new System.Data.OleDb.OleDbCommand("select * from produits;", conn);
rs3 = comm3.ExecuteReader();
while (rs3.Read())
{
refprodstockC1.Items.Add(rs3["codeP"].ToString());
refprodcommandeC1.Items.Add(rs3["codeP"].ToString());
refprodreserveC1.Items.Add(rs3["codeP"].ToString());
}
rs3.Close();


}

}

private void TabConsultation_Click(object sender, EventArgs e)
{

}

private void groupBox1_Enter(object sender, EventArgs e)
{

}

private void label6_Click(object sender, EventArgs e)
{

}

private void b_Valider_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from client where codeC='" + ccodeC1client.Text + "'", conn);
rs = comm.ExecuteReader();
while (rs.Read())
{

nomC1client.Text = rs["Nom"].ToString();
prenomC1client.Text = rs["Prenom"].ToString();
tvaC1client.Text = rs["tva"].ToString();
adresseC1client.Text = rs["adresse"].ToString();
telephoneC1client.Text = rs["tel"].ToString();
mailC1client.Text = rs["mail"].ToString();
cpC1client.Text = rs["cp"].ToString();
villeC1client.Text = rs["ville"].ToString();
paysC1client.Text = rs["pays"].ToString();


}
rs.Close();
}
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void b_ajouter_Click(object sender, EventArgs e)
{
if (ccodeC1client.Text != "" && nomC1client.Text != "" && prenomC1client.Text != "")
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();

conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
int r;
System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("INSERT INTO Client(codeC,Nom,Prenom,tva,adresse,tel,mail,cp,ville,pays) VALUES('" + ccodeC1client.Text + "','" + nomC1client.Text + "','" + prenomC1client.Text + "','" + tvaC1client.Text + "','" + adresseC1client.Text + "','" + telephoneC1client.Text + "','" + mailC1client.Text + "','" + cpC1client.Text + "','" + villeC1client.Text + "','" + paysC1client.Text + "');", conn);
r = command.ExecuteNonQuery();
MessageBox.Show("Operation d'ajout reussie");
//Indication f = new Indication();
//f.Show();
}
}
else
{ //MessageBox.Show ("Certains Champs sont vides");
Erreur001 f = new Erreur001();
f.Show();
}
}

private void button4_Click(object sender, EventArgs e)
{
this.Hide();
}

private void label32_Click(object sender, EventArgs e)
{

}

private void nom_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
{

}

private void groupBox5_Enter(object sender, EventArgs e)
{

}

private void datestockC1_TextChanged(object sender, EventArgs e)
{

}

private void textBox8_TextChanged(object sender, EventArgs e)
{

}

private void modelfactC1_TextChanged(object sender, EventArgs e)
{

}

private void panel2_Paint(object sender, PaintEventArgs e)
{

}



private void Add_Click(object sender, EventArgs e)
{
Panel panelComponementFacture = ComponementFacture(); // creation de l'objet panel avec textbox
this.panel2.Controls.Add(panelComponementFacture);// ajout du panel avec textbox au panel cible
panelComponementFacture.BringToFront();//pour avoir un empilement correctement hierarchisé des panel ajouté

System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from produits where codeP='" + refprodstockC1.Text + "'", conn);
rs = comm.ExecuteReader();
while (rs.Read())
{

// qtfact1.Text = quantitestockC1.Text.ToString();
//typefact1.Text = rs["type"].ToString();
//modelfact1.Text = rs["model"].ToString();
//couleurfact1.Text = rs["couleur"].ToString();
//fournisseurfact1.Text = rs["fournisseur"].ToString();
//prixfact1.Text = rs["prix"].ToString();



}
rs.Close();
}


}

private void qtfact1_TextChanged(object sender, EventArgs e)
{

}

private void TabRecherche_Click(object sender, EventArgs e)
{

}

private void mailC1_TextChanged(object sender, EventArgs e)
{

}

private Panel ComponementFacture()
{

System.Windows.Forms.Panel panel;
System.Windows.Forms.TextBox fournisseurfact1;
System.Windows.Forms.TextBox prixfact1;
System.Windows.Forms.TextBox couleurfact1;
System.Windows.Forms.TextBox modelfact1;
System.Windows.Forms.TextBox typefact1;
System.Windows.Forms.TextBox qtfact1;

panel = new System.Windows.Forms.Panel();
fournisseurfact1 = new System.Windows.Forms.TextBox();
prixfact1 = new System.Windows.Forms.TextBox();
couleurfact1 = new System.Windows.Forms.TextBox();
modelfact1 = new System.Windows.Forms.TextBox();
typefact1 = new System.Windows.Forms.TextBox();
qtfact1 = new System.Windows.Forms.TextBox();
panel.SuspendLayout();
SuspendLayout();
//
// panel
//
panel.Controls.Add(fournisseurfact1);
panel.Controls.Add(prixfact1);
panel.Controls.Add(couleurfact1);
panel.Controls.Add(modelfact1);
panel.Controls.Add(typefact1);
panel.Controls.Add(qtfact1);
panel.Location = new System.Drawing.Point(36, 77);
panel.Name = "panel1" + this.panel2.Controls.Count.ToString();
panel.Size = new System.Drawing.Size(512, 27);
panel.TabIndex = 0;
//
// fournisseurfact1
//
fournisseurfact1.Location = new System.Drawing.Point(341, 3);
fournisseurfact1.Name = "fournisseurfact1" + this.panel2.Controls.Count.ToString();
fournisseurfact1.Size = new System.Drawing.Size(80, 20);
fournisseurfact1.TabIndex = 159;
//
// prixfact1
//
prixfact1.Location = new System.Drawing.Point(424, 3);
prixfact1.Name = "prixfact1" + this.panel2.Controls.Count.ToString();
prixfact1.Size = new System.Drawing.Size(84, 20);
prixfact1.TabIndex = 158;
//
// couleurfact1
//
couleurfact1.Location = new System.Drawing.Point(286, 3);
couleurfact1.Name = "couleurfact1" + this.panel2.Controls.Count.ToString();
couleurfact1.Size = new System.Drawing.Size(52, 20);
couleurfact1.TabIndex = 157;
//
// modelfact1
//
modelfact1.Location = new System.Drawing.Point(98, 3);
modelfact1.Name = "modelfact1" + this.panel2.Controls.Count.ToString();
modelfact1.Size = new System.Drawing.Size(184, 20);
modelfact1.TabIndex = 156;
//
// typefact1
//
typefact1.Location = new System.Drawing.Point(33, 3);
typefact1.Name = "typefact1" + this.panel2.Controls.Count.ToString();
typefact1.Size = new System.Drawing.Size(62, 20);
typefact1.TabIndex = 155;
//
// qtfact1
//
qtfact1.Location = new System.Drawing.Point(6, 3);
qtfact1.Name = "qtfact1" + this.panel2.Controls.Count.ToString();
qtfact1.Size = new System.Drawing.Size(25, 20);
qtfact1.TabIndex = 154;

panel.Dock = DockStyle.Top;
panel.BringToFront();

return panel;
}

private void button2_Click(object sender, EventArgs e)
{
Panel panelComponementFacture = ComponementFacture(); // creation de l'objet panel avec textbox
this.panel2.Controls.Add(panelComponementFacture);// ajout du panel avec textbox au panel cible
panelComponementFacture.BringToFront();//pour avoir un empilement correctement hierarchisé des panel ajouté

System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from produits where codeP='" + refprodstockC1.Text + "'", conn);
rs = comm.ExecuteReader();
while (rs.Read())
{

//qtfact1.Text = quantitestockC1.Text.ToString();
//typefact1.Text = rs["type"].ToString();
//modelfact1.Text = rs["model"].ToString();
//couleurfact1.Text = rs["couleur"].ToString();
//fournisseurfact1.Text = rs["fournisseur"].ToString();
//prixfact1.Text = rs["prix"].ToString();

}
string commande = rs["commande"] + qtcommandeC1.Text;
int codeC = rs["codeC"] +1 ;
int r;
System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("INSERT INTO commande(codeC,marque,fournisseur,type,model,reference,couleur,prixunitaire,commande,taille) VALUES('" + codeC + "','" + rs["marque"] + "','" + rs["fournisseur"] + "','" + rs["type"] + "','" + rs["model"] + "','" + rs["reference"] + "','" + rs["couleur"] + "','" + rs["prixunitaire"] + "','" + commande + "','" + rs["taille"] + "');", conn);
r = command.ExecuteNonQuery();
rs.Close();
}
}

private void button3_Click(object sender, EventArgs e)
{
Panel panelComponementFacture = ComponementFacture(); // creation de l'objet panel avec textbox
this.panel2.Controls.Add(panelComponementFacture);// ajout du panel avec textbox au panel cible
panelComponementFacture.BringToFront();//pour avoir un empilement correctement hierarchisé des panel ajouté

System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from produits where codeP='" + refprodstockC1.Text + "'", conn);
rs = comm.ExecuteReader();
while (rs.Read())
{

// qtfact1.Text = quantitestockC1.Text.ToString();
//typefact1.Text = rs["type"].ToString();
//modelfact1.Text = rs["model"].ToString();
//couleurfact1.Text = rs["couleur"].ToString();
//fournisseurfact1.Text = rs["fournisseur"].ToString();
//prixfact1.Text = rs["prix"].ToString();

}

string reserve = rs["reserve"] + qtcommandeC1.Text;
int codeR = rs["reserve"] + 1;
int r;
System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("INSERT INTO reserve(codeR,marque,fournisseur,type,model,reference,couleur,prixunitaire,reserve,taille) VALUES('" + codeR + "','" + rs["marque"] + "','" + rs["fournisseur"] + "','" + rs["type"] + "','" + rs["model"] + "','" + rs["reference"] + "','" + rs["couleur"] + "','" + rs["prixunitaire"] + "','" + reserve + "','" + rs["taille"] + "');", conn);
r = command.ExecuteNonQuery();

rs.Close();
}

}

private void TabSaisieEntree_Click(object sender, EventArgs e)
{

}



}
}
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
13 déc. 2007 à 15:01
wou merci ca marche :)
plus qu a continuer et a comprendre now lol
merci bcp
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
13 déc. 2007 à 09:34
je te mets 2 étoiles, isole les données redondante (chaine de connexion par exemple) , tu gagnera 1 etoiles (lol) bon courage , volonté, larmes et sang son necessaire dans le dev.

byby
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
13 déc. 2007 à 09:28
une solution opérationel : La Method ComponementFacture() et ensuite trois lignes de code à ajouter dans les événements de click

private Panel ComponementFacture()
{

System.Windows.Forms.Panel panel;
System.Windows.Forms.TextBox fournisseurfact1;
System.Windows.Forms.TextBox prixfact1;
System.Windows.Forms.TextBox couleurfact1;
System.Windows.Forms.TextBox modelfact1;
System.Windows.Forms.TextBox typefact1;
System.Windows.Forms.TextBox qtfact1;

panel = new System.Windows.Forms.Panel();
fournisseurfact1 = new System.Windows.Forms.TextBox();
prixfact1 = new System.Windows.Forms.TextBox();
couleurfact1 = new System.Windows.Forms.TextBox();
modelfact1 = new System.Windows.Forms.TextBox();
typefact1 = new System.Windows.Forms.TextBox();
qtfact1 = new System.Windows.Forms.TextBox();
panel.SuspendLayout();
SuspendLayout();
//
// panel
//
panel.Controls.Add(fournisseurfact1);
panel.Controls.Add(prixfact1);
panel.Controls.Add(couleurfact1);
panel.Controls.Add(modelfact1);
panel.Controls.Add(typefact1);
panel.Controls.Add(qtfact1);
panel.Location = new System.Drawing.Point(36, 77);
panel.Name = "panel1" + this.panel2.Controls.Count.ToString();
panel.Size = new System.Drawing.Size(512, 27);
panel.TabIndex = 0;
//
// fournisseurfact1
//
fournisseurfact1.Location = new System.Drawing.Point(341, 3);
fournisseurfact1.Name = "fournisseurfact1" + this.panel2.Controls.Count.ToString();
fournisseurfact1.Size = new System.Drawing.Size(80, 20);
fournisseurfact1.TabIndex = 159;
//
// prixfact1
//
prixfact1.Location = new System.Drawing.Point(424, 3);
prixfact1.Name = "prixfact1" + this.panel2.Controls.Count.ToString();
prixfact1.Size = new System.Drawing.Size(84, 20);
prixfact1.TabIndex = 158;
//
// couleurfact1
//
couleurfact1.Location = new System.Drawing.Point(286, 3);
couleurfact1.Name = "couleurfact1" + this.panel2.Controls.Count.ToString();
couleurfact1.Size = new System.Drawing.Size(52, 20);
couleurfact1.TabIndex = 157;
//
// modelfact1
//
modelfact1.Location = new System.Drawing.Point(98, 3);
modelfact1.Name = "modelfact1" + this.panel2.Controls.Count.ToString();
modelfact1.Size = new System.Drawing.Size(184, 20);
modelfact1.TabIndex = 156;
//
// typefact1
//
typefact1.Location = new System.Drawing.Point(33, 3);
typefact1.Name = "typefact1" + this.panel2.Controls.Count.ToString();
typefact1.Size = new System.Drawing.Size(62, 20);
typefact1.TabIndex = 155;
//
// qtfact1
//
qtfact1.Location = new System.Drawing.Point(6, 3);
qtfact1.Name = "qtfact1" + this.panel2.Controls.Count.ToString();
qtfact1.Size = new System.Drawing.Size(25, 20);
qtfact1.TabIndex = 154;

panel.Dock = DockStyle.Top ;
panel.BringToFront();

return panel;
}

/// code pour les clik ajouter :
Panel panelComponementFacture = ComponementFacture(); // creation de l'objet panel avec textbox
this.panel2.Controls.Add(panelComponementFacture);// ajout du panel avec textbox au panel cible
panelComponementFacture.BringToFront();//pour avoir un empilement correctement hierarchisé des panel ajouté

Voilà bonne continuation
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
13 déc. 2007 à 08:52
essaye avec cela :

public Panel ComponementFacture()
{
System.Windows.Forms.Panel panel;
System.Windows.Forms.TextBox fournisseurfact1;
System.Windows.Forms.TextBox prixfact1;
System.Windows.Forms.TextBox couleurfact1;
System.Windows.Forms.TextBox modelfact1;
System.Windows.Forms.TextBox typefact1;
System.Windows.Forms.TextBox qtfact1;

panel = new System.Windows.Forms.Panel();
fournisseurfact1 = new System.Windows.Forms.TextBox();
prixfact1 = new System.Windows.Forms.TextBox();
couleurfact1 = new System.Windows.Forms.TextBox();
modelfact1 = new System.Windows.Forms.TextBox();
typefact1 = new System.Windows.Forms.TextBox();
qtfact1 = new System.Windows.Forms.TextBox();
panel.SuspendLayout();
SuspendLayout();
//
// panel
//
panel.Controls.Add(this.fournisseurfact1);
panel.Controls.Add(this.prixfact1);
panel.Controls.Add(this.couleurfact1);
panel.Controls.Add(this.modelfact1);
panel.Controls.Add(this.typefact1);
panel.Controls.Add(this.qtfact1);
panel.Location = new System.Drawing.Point(36, 77);
panel.Name = "panel";
panel.Size = new System.Drawing.Size(512, 27);
panel.TabIndex = 0;
//
// fournisseurfact1
//
fournisseurfact1.Location = new System.Drawing.Point(341, 3);
fournisseurfact1.Name = "fournisseurfact1";
fournisseurfact1.Size = new System.Drawing.Size(80, 20);
fournisseurfact1.TabIndex = 159;
//
// prixfact1
//
prixfact1.Location = new System.Drawing.Point(424, 3);
prixfact1.Name = "prixfact1";
prixfact1.Size = new System.Drawing.Size(84, 20);
prixfact1.TabIndex = 158;
//
// couleurfact1
//
couleurfact1.Location = new System.Drawing.Point(286, 3);
couleurfact1.Name = "couleurfact1";
couleurfact1.Size = new System.Drawing.Size(52, 20);
couleurfact1.TabIndex = 157;
//
// modelfact1
//
modelfact1.Location = new System.Drawing.Point(98, 3);
modelfact1.Name = "modelfact1";
modelfact1.Size = new System.Drawing.Size(184, 20);
modelfact1.TabIndex = 156;
//
// typefact1
//
typefact1.Location = new System.Drawing.Point(33, 3);
typefact1.Name = "typefact1";
typefact1.Size = new System.Drawing.Size(62, 20);
typefact1.TabIndex = 155;
//
// qtfact1
//
qtfact1.Location = new System.Drawing.Point(6, 3);
qtfact1.Name = "qtfact1";
qtfact1.Size = new System.Drawing.Size(25, 20);
qtfact1.TabIndex = 154;


return panel;
}
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
13 déc. 2007 à 03:46
voila j'ai compris en fait le panel apparait mais tout en haut a gauche derrierre maa groupbox, j'ai bo modifier les valeur point, mais il ne bouge pas il reste la en haut a gauche...
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
13 déc. 2007 à 03:24
non desole j ai rien dit j avais pas rajouter de panel sur ma form lol

mais par contre lorsque je clique sur le bouton rien ne se passe, enfin cela ouvre la form mais sans rien dedans... je veu dire pas de textbox
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
13 déc. 2007 à 03:17
tjs cette erreur

Erreur 48 'GestionFamavie.factures' ne contient pas de définition pour 'panel' C:\Users\AngelZ\Documents\Visual Studio 2005\Projects\GestionMeublesFamavieAngelZ\GestionMeublesFamavieAngelZ\factures.cs 323 31 GestionMeublesFamavieAngelZ
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
13 déc. 2007 à 02:48
Voici la correction de la fonction :

C'est le 'this' qui pause problème......

public Panel ComponementFacture()
{
System.Windows.Forms.Panel panel;
System.Windows.Forms.TextBox fournisseurfact1;
System.Windows.Forms.TextBox prixfact1;
System.Windows.Forms.TextBox couleurfact1;
System.Windows.Forms.TextBox modelfact1;
System.Windows.Forms.TextBox typefact1;
System.Windows.Forms.TextBox qtfact1;

panel = new System.Windows.Forms.Panel();
fournisseurfact1 = new System.Windows.Forms.TextBox();
prixfact1 = new System.Windows.Forms.TextBox();
couleurfact1 = new System.Windows.Forms.TextBox();
modelfact1 = new System.Windows.Forms.TextBox();
typefact1 = new System.Windows.Forms.TextBox();
qtfact1 = new System.Windows.Forms.TextBox();
panel.SuspendLayout();
SuspendLayout();
//
// panel
//
panel.Controls.Add(this.fournisseurfact1);
panel.Controls.Add(this.prixfact1);
panel.Controls.Add(this.couleurfact1);
panel.Controls.Add(this.modelfact1);
panel.Controls.Add(this.typefact1);
panel.Controls.Add(this.qtfact1);
panel.Location = new System.Drawing.Point(36, 77);
panel.Name = "panel";
panel.Size = new System.Drawing.Size(512, 27);
panel.TabIndex = 0;
//
// fournisseurfact1
//
fournisseurfact1.Location = new System.Drawing.Point(341, 3);
fournisseurfact1.Name = "fournisseurfact1";
fournisseurfact1.Size = new System.Drawing.Size(80, 20);
fournisseurfact1.TabIndex = 159;
//
// prixfact1
//
prixfact1.Location = new System.Drawing.Point(424, 3);
prixfact1.Name = "prixfact1";
prixfact1.Size = new System.Drawing.Size(84, 20);
prixfact1.TabIndex = 158;
//
// couleurfact1
//
couleurfact1.Location = new System.Drawing.Point(286, 3);
couleurfact1.Name = "couleurfact1";
couleurfact1.Size = new System.Drawing.Size(52, 20);
couleurfact1.TabIndex = 157;
//
// modelfact1
//
modelfact1.Location = new System.Drawing.Point(98, 3);
modelfact1.Name = "modelfact1";
modelfact1.Size = new System.Drawing.Size(184, 20);
modelfact1.TabIndex = 156;
//
// typefact1
//
typefact1.Location = new System.Drawing.Point(33, 3);
typefact1.Name = "typefact1";
typefact1.Size = new System.Drawing.Size(62, 20);
typefact1.TabIndex = 155;
//
// qtfact1
//
qtfact1.Location = new System.Drawing.Point(6, 3);
qtfact1.Name = "qtfact1";
qtfact1.Size = new System.Drawing.Size(25, 20);
qtfact1.TabIndex = 154;
//
// Form1
//
AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(578, 266);
Controls.Add(this.panel);
Name = "Form1";
Text = "Form1";
panel.ResumeLayout(false);
panel.PerformLayout();
ResumeLayout(false);

return panel;
}
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
12 déc. 2007 à 23:18
bon voici ce que donne ma page facture ...

mais il me dit qu il connait pas panel en gros...

je represise je suis super noob en programmation c#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GestionFamavie
{
public partial class factures : Form
{
public factures()
{
InitializeComponent();

}

private void factures_Load(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs1;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from info_famavie;", conn);

rs1 = comm.ExecuteReader();

while (rs1.Read())
{

nomC1.Text = rs1["societe"].ToString();
tvaC1.Text = rs1["tva"].ToString();
compteC1.Text = rs1["compte"].ToString();
telC1.Text = rs1["tel"].ToString();
adresseC1.Text = rs1["adresse"].ToString();
cpC1.Text = rs1["cp"].ToString();
villeC1.Text = rs1["ville"].ToString();
paysC1.Text = rs1["pays"].ToString();
mailC1.Text = rs1["mail"].ToString();
siteC1.Text = rs1["site"].ToString();



}
rs1.Close();

System.Data.OleDb.OleDbDataReader rs2;
System.Data.OleDb.OleDbCommand comm1 = new System.Data.OleDb.OleDbCommand("select * from client;", conn);
rs2 = comm1.ExecuteReader();
while (rs2.Read())
{
ccodeC1client.Items.Add(rs2["codeC"].ToString());
}
rs2.Close();

System.Data.OleDb.OleDbDataReader rs3;
System.Data.OleDb.OleDbCommand comm3 = new System.Data.OleDb.OleDbCommand("select * from produits;", conn);
rs3 = comm3.ExecuteReader();
while (rs3.Read())
{
refprodstockC1.Items.Add(rs3["codeP"].ToString());
refprodcommandeC1.Items.Add(rs3["codeP"].ToString());
refprodreserveC1.Items.Add(rs3["codeP"].ToString());
}
rs3.Close();


}

}

private void TabConsultation_Click(object sender, EventArgs e)
{

}

private void groupBox1_Enter(object sender, EventArgs e)
{

}

private void label6_Click(object sender, EventArgs e)
{

}

private void b_Valider_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
System.Data.OleDb.OleDbDataReader rs;
System.Data.OleDb.OleDbCommand comm = new System.Data.OleDb.OleDbCommand("select * from client where codeC='" + ccodeC1client.Text + "'", conn);
rs = comm.ExecuteReader();
while (rs.Read())
{

nomC1client.Text = rs["Nom"].ToString();
prenomC1client.Text = rs["Prenom"].ToString();
tvaC1client.Text = rs["tva"].ToString();
adresseC1client.Text = rs["adresse"].ToString();
telephoneC1client.Text = rs["tel"].ToString();
mailC1client.Text = rs["mail"].ToString();
cpC1client.Text = rs["cp"].ToString();
villeC1client.Text = rs["ville"].ToString();
paysC1client.Text = rs["pays"].ToString();


}
rs.Close();
}
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void b_ajouter_Click(object sender, EventArgs e)
{
if (ccodeC1client.Text != "" && nomC1client.Text != "" && prenomC1client.Text != "")
{
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();

conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source= c:\famavie\famavie.mdb";
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show("Notre connection n'est pas établit");
}
finally
{
int r;
System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand("INSERT INTO Client(codeC,Nom,Prenom,tva,adresse,tel,mail,cp,ville,pays) VALUES('" + ccodeC1client.Text + "','" + nomC1client.Text + "','" + prenomC1client.Text + "','" + tvaC1client.Text + "','" + adresseC1client.Text + "','" + telephoneC1client.Text + "','" + mailC1client.Text + "','" + cpC1client.Text + "','" + villeC1client.Text + "','" + paysC1client.Text + "');", conn);
r = command.ExecuteNonQuery();
MessageBox.Show("Operation d'ajout reussie");
//Indication f = new Indication();
//f.Show();
}
}
else
{ //MessageBox.Show ("Certains Champs sont vides");
Erreur001 f = new Erreur001();
f.Show();
}
}

private void button4_Click(object sender, EventArgs e)
{
this.Hide();
}

private void label32_Click(object sender, EventArgs e)
{

}

private void nom_SelectedIndexChanged(object sender, EventArgs e)
{

}

private void comboBox1_SelectedIndexChanged_1(object sender, EventArgs e)
{

}

private void groupBox5_Enter(object sender, EventArgs e)
{

}

private void datestockC1_TextChanged(object sender, EventArgs e)
{

}

private void textBox8_TextChanged(object sender, EventArgs e)
{

}

private void modelfactC1_TextChanged(object sender, EventArgs e)
{

}

private void panel2_Paint(object sender, PaintEventArgs e)
{

}



private void Add_Click(object sender, EventArgs e)
{
this.panel2.Controls.Add(ComponementFacture());

}

private void qtfact1_TextChanged(object sender, EventArgs e)
{

}

private void TabRecherche_Click(object sender, EventArgs e)
{

}

private void mailC1_TextChanged(object sender, EventArgs e)
{

}

public Panel ComponementFacture()
{

System.Windows.Forms.Panel panel;
System.Windows.Forms.TextBox fournisseurfact1;
System.Windows.Forms.TextBox prixfact1;
System.Windows.Forms.TextBox couleurfact1;
System.Windows.Forms.TextBox modelfact1;
System.Windows.Forms.TextBox typefact1;
System.Windows.Forms.TextBox qtfact1;

this.panel = new System.Windows.Forms.Panel();
this.fournisseurfact1 = new System.Windows.Forms.TextBox();
this.prixfact1 = new System.Windows.Forms.TextBox();
this.couleurfact1 = new System.Windows.Forms.TextBox();
this.modelfact1 = new System.Windows.Forms.TextBox();
this.typefact1 = new System.Windows.Forms.TextBox();
this.qtfact1 = new System.Windows.Forms.TextBox();
this.panel.SuspendLayout();
this.SuspendLayout();
//
// panel
//
this.panel.Controls.Add(this.fournisseurfact1);
this.panel.Controls.Add(this.prixfact1);
this.panel.Controls.Add(this.couleurfact1);
this.panel.Controls.Add(this.modelfact1);
this.panel.Controls.Add(this.typefact1);
this.panel.Controls.Add(this.qtfact1);
this.panel.Location = new System.Drawing.Point(36, 77);
this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(512, 27);
this.panel.TabIndex = 0;
//
// fournisseurfact1
//
this.fournisseurfact1.Location = new System.Drawing.Point(341, 3);
this.fournisseurfact1.Name = "fournisseurfact1";
this.fournisseurfact1.Size = new System.Drawing.Size(80, 20);
this.fournisseurfact1.TabIndex = 159;
//
// prixfact1
//
this.prixfact1.Location = new System.Drawing.Point(424, 3);
this.prixfact1.Name = "prixfact1";
this.prixfact1.Size = new System.Drawing.Size(84, 20);
this.prixfact1.TabIndex = 158;
//
// couleurfact1
//
this.couleurfact1.Location = new System.Drawing.Point(286, 3);
this.couleurfact1.Name = "couleurfact1";
this.couleurfact1.Size = new System.Drawing.Size(52, 20);
this.couleurfact1.TabIndex = 157;
//
// modelfact1
//
this.modelfact1.Location = new System.Drawing.Point(98, 3);
this.modelfact1.Name = "modelfact1";
this.modelfact1.Size = new System.Drawing.Size(184, 20);
this.modelfact1.TabIndex = 156;
//
// typefact1
//
this.typefact1.Location = new System.Drawing.Point(33, 3);
this.typefact1.Name = "typefact1";
this.typefact1.Size = new System.Drawing.Size(62, 20);
this.typefact1.TabIndex = 155;
//
// qtfact1
//
this.qtfact1.Location = new System.Drawing.Point(6, 3);
this.qtfact1.Name = "qtfact1";
this.qtfact1.Size = new System.Drawing.Size(25, 20);
this.qtfact1.TabIndex = 154;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(578, 266);
this.Controls.Add(this.panel);
this.Name = "Form1";
this.Text = "Form1";
this.panel.ResumeLayout(false);
this.panel.PerformLayout();
this.ResumeLayout(false);

return panel;



}




}
}
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
12 déc. 2007 à 12:42
waou merci pour les reponse :) ca fait plaisir :

mais qd je rajoute ce code il me dit
Erreur 48 'GestionFamavie.factures' ne contient pas de définition pour 'panel' C:\Users\AngelZ\Documents\Visual Studio 2005\Projects\GestionMeublesFamavieAngelZ\GestionMeublesFamavieAngelZ\factures.cs 252 18 GestionMeublesFamavieAngelZ
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
12 déc. 2007 à 06:15
correction de mon code pour la fonction ComponementFacture (suppresion de la fin à partir de //form1......(cela traine du designer bref ... c mieux comme ça , sinon ta form principale aurait fait des sienne )

byby Stef a C# addict

public Panel ComponementFacture()
{

System.Windows.Forms.Panel panel;
System.Windows.Forms.TextBox fournisseurfact1;
System.Windows.Forms.TextBox prixfact1;
System.Windows.Forms.TextBox couleurfact1;
System.Windows.Forms.TextBox modelfact1;
System.Windows.Forms.TextBox typefact1;
System.Windows.Forms.TextBox qtfact1;

this.panel = new System.Windows.Forms.Panel();
this.fournisseurfact1 = new System.Windows.Forms.TextBox();
this.prixfact1 = new System.Windows.Forms.TextBox();
this.couleurfact1 = new System.Windows.Forms.TextBox();
this.modelfact1 = new System.Windows.Forms.TextBox();
this.typefact1 = new System.Windows.Forms.TextBox();
this.qtfact1 = new System.Windows.Forms.TextBox();
this.panel.SuspendLayout();
this.SuspendLayout();
//
// panel
//
this.panel.Controls.Add(this.fournisseurfact1);
this.panel.Controls.Add(this.prixfact1);
this.panel.Controls.Add(this.couleurfact1);
this.panel.Controls.Add(this.modelfact1);
this.panel.Controls.Add(this.typefact1);
this.panel.Controls.Add(this.qtfact1);
this.panel.Location = new System.Drawing.Point(36, 77);
this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(512, 27);
this.panel.TabIndex = 0;
//
// fournisseurfact1
//
this.fournisseurfact1.Location = new System.Drawing.Point(341, 3);
this.fournisseurfact1.Name = "fournisseurfact1";
this.fournisseurfact1.Size = new System.Drawing.Size(80, 20);
this.fournisseurfact1.TabIndex = 159;
//
// prixfact1
//
this.prixfact1.Location = new System.Drawing.Point(424, 3);
this.prixfact1.Name = "prixfact1";
this.prixfact1.Size = new System.Drawing.Size(84, 20);
this.prixfact1.TabIndex = 158;
//
// couleurfact1
//
this.couleurfact1.Location = new System.Drawing.Point(286, 3);
this.couleurfact1.Name = "couleurfact1";
this.couleurfact1.Size = new System.Drawing.Size(52, 20);
this.couleurfact1.TabIndex = 157;
//
// modelfact1
//
this.modelfact1.Location = new System.Drawing.Point(98, 3);
this.modelfact1.Name = "modelfact1";
this.modelfact1.Size = new System.Drawing.Size(184, 20);
this.modelfact1.TabIndex = 156;
//
// typefact1
//
this.typefact1.Location = new System.Drawing.Point(33, 3);
this.typefact1.Name = "typefact1";
this.typefact1.Size = new System.Drawing.Size(62, 20);
this.typefact1.TabIndex = 155;
//
// qtfact1
//
this.qtfact1.Location = new System.Drawing.Point(6, 3);
this.qtfact1.Name = "qtfact1";
this.qtfact1.Size = new System.Drawing.Size(25, 20);
this.qtfact1.TabIndex = 154;

//
//partie de code supprimé
//

return panel;

}
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
12 déc. 2007 à 06:05
ha oui j'aller oublier , prend l'habitude de nomer tout tes controle que tu pose dans le designer.Si tu as l'occasion de travailler en équipe , ça t'evitera de prendre des coups de souris par tes coequiper, mais surtout quand tu code ta pas à faire des allez retour pour savoir quel est le panel4 de la form from5 lol ......allez je te laisse bon code
Stef ==> Mail jackcarver@hotmail.fr
AnMullerDeKush Messages postés 13 Date d'inscription jeudi 23 octobre 2003 Statut Membre Dernière intervention 14 décembre 2007
12 déc. 2007 à 06:00
Salut voici une solution :

Il est très commun d'utiliser la propriété Controls des composant du designer. en lui ajoutant des nouveaux controls à l'éxecution.... sans rentrer dans les détails voici une ébauche de réponse.

en premier voici une fonction creant les textboxs incluse dans un panel ; il faut l'améliorer pour
avoir des nom differents pour toutes les textboxs, sinon il y aurat une collision de nom.(on peut utiliser un compteur par exemple)
Cette fonction renvoie un panel , il suffit ensuite de l'ajouter à la propriété Controls du panel cible : Panel2

public Panel ComponementFacture()
{

System.Windows.Forms.Panel panel;
System.Windows.Forms.TextBox fournisseurfact1;
System.Windows.Forms.TextBox prixfact1;
System.Windows.Forms.TextBox couleurfact1;
System.Windows.Forms.TextBox modelfact1;
System.Windows.Forms.TextBox typefact1;
System.Windows.Forms.TextBox qtfact1;

this.panel = new System.Windows.Forms.Panel();
this.fournisseurfact1 = new System.Windows.Forms.TextBox();
this.prixfact1 = new System.Windows.Forms.TextBox();
this.couleurfact1 = new System.Windows.Forms.TextBox();
this.modelfact1 = new System.Windows.Forms.TextBox();
this.typefact1 = new System.Windows.Forms.TextBox();
this.qtfact1 = new System.Windows.Forms.TextBox();
this.panel.SuspendLayout();
this.SuspendLayout();
//
// panel
//
this.panel.Controls.Add(this.fournisseurfact1);
this.panel.Controls.Add(this.prixfact1);
this.panel.Controls.Add(this.couleurfact1);
this.panel.Controls.Add(this.modelfact1);
this.panel.Controls.Add(this.typefact1);
this.panel.Controls.Add(this.qtfact1);
this.panel.Location = new System.Drawing.Point(36, 77);
this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(512, 27);
this.panel.TabIndex = 0;
//
// fournisseurfact1
//
this.fournisseurfact1.Location = new System.Drawing.Point(341, 3);
this.fournisseurfact1.Name = "fournisseurfact1";
this.fournisseurfact1.Size = new System.Drawing.Size(80, 20);
this.fournisseurfact1.TabIndex = 159;
//
// prixfact1
//
this.prixfact1.Location = new System.Drawing.Point(424, 3);
this.prixfact1.Name = "prixfact1";
this.prixfact1.Size = new System.Drawing.Size(84, 20);
this.prixfact1.TabIndex = 158;
//
// couleurfact1
//
this.couleurfact1.Location = new System.Drawing.Point(286, 3);
this.couleurfact1.Name = "couleurfact1";
this.couleurfact1.Size = new System.Drawing.Size(52, 20);
this.couleurfact1.TabIndex = 157;
//
// modelfact1
//
this.modelfact1.Location = new System.Drawing.Point(98, 3);
this.modelfact1.Name = "modelfact1";
this.modelfact1.Size = new System.Drawing.Size(184, 20);
this.modelfact1.TabIndex = 156;
//
// typefact1
//
this.typefact1.Location = new System.Drawing.Point(33, 3);
this.typefact1.Name = "typefact1";
this.typefact1.Size = new System.Drawing.Size(62, 20);
this.typefact1.TabIndex = 155;
//
// qtfact1
//
this.qtfact1.Location = new System.Drawing.Point(6, 3);
this.qtfact1.Name = "qtfact1";
this.qtfact1.Size = new System.Drawing.Size(25, 20);
this.qtfact1.TabIndex = 154;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(578, 266);
this.Controls.Add(this.panel);
this.Name = "Form1";
this.Text = "Form1";
this.panel.ResumeLayout(false);
this.panel.PerformLayout();
this.ResumeLayout(false);

return panel;

}

dans le click du add , tu rajoute le code :

this.panel2.Controls.Add(ComponementFacture());

bon cela ne va pas marcher du premier coup (lol) , il faut organiser le panel2, par exemple avec ce principe de panel que tu ajoute , en les empilant grace à la propriété Dock affecté avec valeur TOP et la fonction BringToFront pour avoir une bonne hierarchisation des panel ajouté.....

En esperant que cela te guidera.......
Sinon ton code pour une semaine de C# est pas trop mal.

NB : La chaine de connexion centralise là avec une seule propriété, dans une classe de parametrage par exemple . Pense à pouvoir configurer le chemin d'accés à ta BD car il faut la modiifer dans le code (la même chaine de connexion est placé 53 fois dans le code , petite erreure de débutant).

bon courage .Stef
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
11 déc. 2007 à 23:16
oki merci et je voulais pas du tout etre agresssif dison que mon bo pere me tane lol et ...
mais bon je vais ete patien :)

merci en tout cas :)
MorpionMx Messages postés 3466 Date d'inscription lundi 16 octobre 2000 Statut Membre Dernière intervention 30 octobre 2008 57
11 déc. 2007 à 21:25
Salut,

Je prends mon cas : j'ai absolument pas le temps en semaine d'analyser les sources qui sont postées. En plus, ta source ayant un sujet très ciblé, y'a peut-etre moins de personnes qui l'essaient (au moment où je te parle, vue 455 fois mais téléchargée une fois). Il faut parfois être très patient avant d'avoir des retours. Y'a des periodes ou les personnes sont moins disponibles que d'autres.

Par contre, si tu as besoin d'aide, n'hésite pas a aller poser des questions dans le forum, en faisant référence a ta source (et en ciblant bien les portions de code ou les fonctionnalités qui te posent probleme).

:)
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
11 déc. 2007 à 16:21
source vu 423 fois et pas un seul commentaire ou aide ... mmm sympa :)
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
10 déc. 2007 à 20:32
personne n a d'idée ?
angelz Messages postés 67 Date d'inscription jeudi 22 septembre 2005 Statut Membre Dernière intervention 11 avril 2013
9 déc. 2007 à 21:45
merci v faire de suite
MorpionMx Messages postés 3466 Date d'inscription lundi 16 octobre 2000 Statut Membre Dernière intervention 30 octobre 2008 57
9 déc. 2007 à 21:17
Salut,

Il faut que tu déposes ta source sur le site, autrement celle-ci sera supprimée.
Pour passer outre la restriction de taille, tu peux commencer par supprimer le repertoire BIN de ton archive, qui prend dejà plus de 2 Mo. Tu peux aussi supprimer le repertoire obj qui en prend presque autant. Tout de suite, ton archive se sent plus légère :)