IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Probleme CurrencyManager ne fonction pas.


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre actif
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    47
    Détails du profil
    Informations personnelles :
    Localisation : Indonésie

    Informations forums :
    Inscription : Octobre 2006
    Messages : 47
    Par défaut Probleme CurrencyManager ne fonction pas.
    Bonsoir, cela fait deux jours j'ai essayé de résoudre le problème de CurrencyManager mais en vain. Mon problème c'est que je n'arrive pas à balayer les enregistrement dans DataSet. Quelqu'un peut-il m'aider à résoudre mon problème S.V.P. Merci d'avance
    Voici mes codes:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    /*Connection vers MySQL*/
    using MySql.Data;
    using MySql.Data.MySqlClient;
     
    namespace prjTestCM
    {
        public partial class Form1 : Form
        {
            private CurrencyManager objCM;
     
            public Form1()
            {
                InitializeComponent();
            }
     
            private void Form1_Load(object sender, EventArgs e)
            {
                // Open a connection to the SQL Server Northwind database. 
                // Modify the following line to connect with your MySQL Server and log on.
                MySqlConnection con = new MySqlConnection("server=localhost; user=admin; database=laserdisc; port=3306; password=secret;");
     
                // Open the Acteurs table.
                MySqlDataAdapter daCust = new MySqlDataAdapter("SELECT * FROM t_acteurs",con);
     
                // Store the Acteurs into a local table.
                DataSet ds = new DataSet();
                daCust.Fill(ds, "Acteurs");
     
                // Bind the TextBox controls to the fields of the Acteurs table.
                textBox1.DataBindings.Add("Text", ds.Tables["Acteurs"], "ID_ACTEUR");
                textBox2.DataBindings.Add("Text", ds.Tables["Acteurs"], "PRENOM_ACTEUR");
                textBox3.DataBindings.Add("Text", ds.Tables["Acteurs"], "NOM_ACTEUR");
     
                // Specify the CurrencyManager for the Acteurs table.
                objCM = (CurrencyManager)this.BindingContext[ds.Tables["Employees"]];
     
                // Specify the event handlers for the CurrencyManager.
                objCM.CurrentChanged += new EventHandler(Current_Changed);
                objCM.ItemChanged += new ItemChangedEventHandler(CurrencyManager_ItemChanged);
                objCM.PositionChanged += new EventHandler(Position_Changed);
            }
     
            private void Current_Changed(object sender, EventArgs e)
            {
                MessageBox.Show("Current_Changed");
            }
     
            private void CurrencyManager_ItemChanged(object sender, System.Windows.Forms.ItemChangedEventArgs e)
            {
                MessageBox.Show("Item_Changed");
            }
     
            private void Position_Changed(object sender, EventArgs e)
            {
                MessageBox.Show("Position_Changed");
            }
     
            private void cmdFirst_Click(object sender, EventArgs e)
            {
                // Move to the first row in the DataTable.
                objCM.Position = 0;
            }
     
            private void cmdPrevious_Click(object sender, EventArgs e)
            {
                // If you are positioned past the first row,
                if (objCM.Position > 0)
                {
                    // move back one row.
                    objCM.Position -= 1;
                }
            }
     
            private void cmdNext_Click(object sender, EventArgs e)
            {
                // If you are positioned before the last row,
                if (objCM.Position < objCM.Count)
                {
                    //move back one row.
                    objCM.Position += 1;
                }
            }
     
            private void cmdLast_Click(object sender, EventArgs e)
            {
                // Position at the last row.
                objCM.Position = objCM.Count;
            }
     
            private void cmdCancelEdit_Click(object sender, EventArgs e)
            {
                // Cancel the current editing in the bound controls.
                objCM.CancelCurrentEdit();
            }
        }//Fin cls.
    }

  2. #2
    Membre chevronné

    Avatar de Deepin
    Homme Profil pro
    Ingénieur - Chef de projet Modélisation/Simulation
    Inscrit en
    Avril 2004
    Messages
    3 164
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Afrique Du Sud

    Informations professionnelles :
    Activité : Ingénieur - Chef de projet Modélisation/Simulation
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2004
    Messages : 3 164
    Par défaut
    Salut,

    La réponse pourrait être utile aux autres. Merci de la poster

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [LG]Probleme avec une fonction
    Par xavier1936 dans le forum Langage
    Réponses: 7
    Dernier message: 08/02/2005, 22h48
  2. Javascript qui ne fonctione pas partout
    Par nad dans le forum Général JavaScript
    Réponses: 6
    Dernier message: 22/11/2004, 17h51
  3. Probleme sur une fonction vérif
    Par PrinceMaster77 dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 29/10/2004, 13h25
  4. gethostbyaddr ne fonctione pas?
    Par Pope dans le forum Réseau/Web
    Réponses: 2
    Dernier message: 08/10/2004, 04h53
  5. autre probleme pour deriver fonction
    Par voyageur dans le forum Mathématiques
    Réponses: 15
    Dernier message: 28/07/2003, 14h37

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo