Bonjour à tous,
J'ai à nouveau un petit problème... je cherche à faire une inputbox a double condition Pour la saisie d'un nom ET d'un prénom...
J'ai bien un modèle simple:
Mais si j'essaye de l'adapter sous cette forme;
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 public partial class frmInput : Form { public frmInput(string windowTitle, string question, string defaultText) { InitializeComponent(); this.Text = windowTitle; this.label1.Text = question; this.textBox1.Text = defaultText; } public static DialogResult ShowfrmInput(string windowTitle, string question, ref string defaultText) { using (frmInput dlg = new frmInput(windowTitle, question, defaultText)) { dlg.Text = windowTitle; dlg.label1.Text = question; dlg.textBox1.Text = defaultText; DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK) defaultText = dlg.textBox1.Text; return result; } } }
J'ai l'erreur suivant:
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 public partial class frmInputContact : Form { public frmInputContact(string defaultText1, string defaultText2) { InitializeComponent(); this.textBox1.Text = defaultText1; this.textBox2.Text = defaultText2; } public static DialogResult ShowfrmInputContact(ref string defaultText1,ref string defaultText2) { frmInputContact dlg = new frmInputContact(defaultText1, defaultText2); DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK) return result; }Comment faire une inputbox avec deux textbox et qui n'est valider que si les deux textbox sont différentes de "" ?'ProjectDBClient.frmInputContact.ShowfrmInputContact(ref string, ref string)'*: tous les chemins de code ne retournent pas nécessairement une valeur
Merci
Partager