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

Windows Forms Discussion :

connexion entre deux interface graphique


Sujet :

Windows Forms

  1. #1
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    26
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 26
    Points : 16
    Points
    16
    Par défaut connexion entre deux interface graphique
    Bonjour
    je voudrais connecter deux interfaces graphique édités par c# de maniere a ce que quand je clique sur le bouton connexion s'affiche la deuxième interface.
    Une idee comment faire pour realiser cela ?
    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
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Oracle.DataAccess;
    using Oracle.DataAccess.Client;
     
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
     
     
            private void button1_Click(object sender, EventArgs e)
            {
                string oradb = "Data Source=XE;User Id=system ;Password=0000;";
     
                OracleConnection conn = new OracleConnection(oradb);
                conn.Open();
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;
                cmd.CommandText = "select * from UTLIL";
     
     
                OracleDataReader dr;
                try
                {
                    cmd.CommandType = CommandType.Text;
                    dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
     
                        if ((dr["login"].ToString() == textBox1.Text) && (dr["mot_de_passe"].ToString() == textBox2.Text))
                        {
     
                            /*  Ajouter aj = new Ajouter();
                              aj.Show();
     
     
                              conn.Dispose();
                              Close();*/
                        }
     
     
                        else if ((textBox1.Text.ToString() == "") && (textBox2.Text.ToString() == ""))
                        {
     
                            MessageBox.Show("Entrez votre login et mot de passe", "Vérification de la saisie", MessageBoxButtons.OK, MessageBoxIcon.Error);
     
                        }
                        else if ((textBox1.Text.ToString() == "") && (textBox2.Text.ToString() != ""))
                        {
     
                            MessageBox.Show("Entrez votre login ", "Vérification de la saisie", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else if ((textBox1.Text.ToString() != "") && (textBox2.Text.ToString() == ""))
                        {
                            MessageBox.Show("Entrez votre mot de passe ", "Vérification de la saisie", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        else
                        {
                            MessageBox.Show("login ou mot de passe incorrect", "Vérification de la saisie", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            textBox2.Text = "";
     
                        }
                    }
     
                }
     
                catch (OracleException ex)
                {
     
                    Console.WriteLine(ex.ToString());
     
                }
            } 
        }
    }
    le deuxieme code
    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
    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
     
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Dermalog.Afis.CodingMatching;
     
    namespace SimpleCMDemo
    {
    	public partial class Form1 : Form
    	{
    		private Dermalog.Afis.CodingMatching.FingerprintEncoder encoder = null;
    		private FingerprintTemplate[] twofingers = new FingerprintTemplate[2];
    		private bool isfirstfinger = true;
    		public Form1()
    		{
    			InitializeComponent();
    			try
    			{
     
    				encoder = new Dermalog.Afis.CodingMatching.FingerprintEncoder();
    				encoder.BeginEncoding += new BeginEncodingEventHandler(encoder_BeginEncoding);
    				encoder.EndEncoding += new EndEncodingEventHandler(encoder_EndEncoding);
    				encoder.ProgressEncoding += new ProgressEncodingEventHandler(encoder_ProgressEncoding);
            encoder.EncodingError += new EncodingErrorEventHandler(encoder_EncodingError);
     
    			}
    			catch (Exception exp)
    			{
     
    				MessageBox.Show(exp.ToString());
    			}
    		}
     
        void encoder_EncodingError(object sender, EncodingErrorEventArgs e)
        {
          MessageBox.Show(e.Message);
        }
     
    		void encoder_ProgressEncoding(object sender, EncodingProgressEventArgs e)
    		{
    			System.Diagnostics.Trace.WriteLine("ProgressEncoding " + e.Step.ToString());
    			if (statusStrip1.InvokeRequired)
    			{
    				ProgressEncodingEventHandler progress = new ProgressEncodingEventHandler(encoder_ProgressEncoding);
    				statusStrip1.Invoke(progress, new object[] { sender, e });
    			}
    			else
    			{
    				encodingProgressBar.Value = e.Step;
    			}
    		}
     
    		void encoder_EndEncoding(object sender, EncodingEventArgs e)
    		{
    			System.Diagnostics.Trace.WriteLine("EndEncoding");
    			if (statusStrip1.InvokeRequired)
    			{
    				EndEncodingEventHandler end = new EndEncodingEventHandler(encoder_EndEncoding);
    				statusStrip1.Invoke(end, new object[] { sender, e });
    			}
    			else
    			{
    				encodingProgressBar.Visible = false;
    				if (IsFirstFinger)
    				{
     
    					twofingers[0] = e.Template;
    					qcBar1.Value = (int)twofingers[0].Quality;
    					isfirstfinger = false;
    				}
    				else
    				{
    					twofingers[1] = e.Template;
    					qcBar2.Value = (int)twofingers[1].Quality;
    					isfirstfinger = true;
     
    				}
     
    			}
    		}
     
    		void encoder_BeginEncoding(object sender, EventArgs e)
    		{
    			System.Diagnostics.Trace.WriteLine("BeginEncoding");
    			if (statusStrip1.InvokeRequired)
    			{
    				BeginEncodingEventHandler begin = new BeginEncodingEventHandler(encoder_BeginEncoding);
    				statusStrip1.Invoke(begin, new object[] { sender, e });
    			}
    			else
    			{
    				encodingProgressBar.Visible = true;
    			}
     
    		}
     
    		private void openToolStripMenuItem_Click(object sender, EventArgs e)
    		{
    			if (qcBar1.Value > 0)
    			{
    				qcBar1.Value = 0;
     
    			}
     
    			OpenFileDialog dlg = new OpenFileDialog();
    			dlg.Filter = "Bitmap Files|*.bmp";
    			if (dlg.ShowDialog(this) == DialogResult.OK)
    			{
    				if (IsFirstFinger)
    				{
    					pictureBox1.Image = Image.FromFile(dlg.FileName);
    					qcBar1.Value = 0;
    					encoder.EncodeAsynchronous(TemplateFormat.Dermalog, pictureBox1.Image);
     
    				}
    				else
    				{
    					pictureBox2.Image = Image.FromFile(dlg.FileName);
    					qcBar2.Value = 0;
    					encoder.EncodeAsynchronous(TemplateFormat.Dermalog, pictureBox2.Image);
    				}
     
    			}
    		}
     
    		private void exitToolStripMenuItem_Click(object sender, EventArgs e)
    		{
    			Application.Exit();
    		}
     
    		private void btnCompare_Click(object sender, EventArgs e)
    		{
    			if (twofingers[0] != null && twofingers[1] != null)
    			{
    				MessageBox.Show(string.Format("Score = {0} ", Math.Round(twofingers[0].CompareTo(twofingers[1]))));
    			}
    		}
    		#region properties
    		private bool IsFirstFinger
    		{
    			get
    			{
    				return isfirstfinger;
    			}
    		}
    		#endregion
     
     
    	}
    }
    Merci.

  2. #2
    Membre actif
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2011
    Messages
    141
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 33
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2011
    Messages : 141
    Points : 201
    Points
    201
    Par défaut
    Oui, et quel est ton problème?

  3. #3
    Membre à l'essai
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2012
    Messages
    26
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2012
    Messages : 26
    Points : 16
    Points
    16
    Par défaut faire connexion entre deux forms
    Bonjour

    Je voudrais faire une connexion entre deux forms mais je me prend une erreur
    error CS0246: The type or namespace name 'Form2' could not be found (are you missing a using directive or an assembly reference?)
    Voici l'application
    http://www.2shared.com/file/mbT3ohrZ/SimpleCMDemo.html

    Une idée svp ?
    Merci

  4. #4
    Membre émérite
    Avatar de azstar
    Homme Profil pro
    Architecte Technique BizTalk/.NET
    Inscrit en
    Juillet 2008
    Messages
    1 198
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Technique BizTalk/.NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 198
    Points : 2 424
    Points
    2 424
    Par défaut
    bonjour ;

    dans ton projet la form1 a comme namespace SimpleCMDemo
    et la form2 a comme namespace WindowsFormsApplication1

    il suffit de changer le "WindowsFormsApplication1" avec "SimpleCMDemo "dans la Form2 pour éviter le problème...

    n'oublier pas

Discussions similaires

  1. Héritage entre deux interfaces graphique
    Par Marie.B dans le forum Débuter
    Réponses: 0
    Dernier message: 10/04/2009, 09h22
  2. Lien entre deux interfaces gui
    Par tenderstoune dans le forum Interfaces Graphiques
    Réponses: 6
    Dernier message: 19/06/2007, 05h21
  3. Etablir une connexion entre deux postes
    Par blondelle dans le forum C++Builder
    Réponses: 35
    Dernier message: 01/10/2006, 12h48
  4. connexion entre deux ordinateurs par modem analogique
    Par devl83 dans le forum Hardware
    Réponses: 3
    Dernier message: 31/01/2006, 16h48
  5. Connexion entre deux ordi [Débutant]
    Par Ryadus dans le forum Développement
    Réponses: 2
    Dernier message: 12/06/2003, 21h47

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