Bonjour Tout le monde
Je débute avec c# j'ai besoin de votre aide ,
Moi j'ai cré un bouton et une zone de text dynamiquement avec c# sous visual studio 2008
l'évènement click sur le bouton m'affiche un calendreir et la selection de date de calendrier sera afficher dans ma zone de texte cré dynamiquement .. mon problème ce que j'arrive pas à trouver la zone de texte voilà mon code :
je veux que la date s'affiche dans la zone de texte t !!!
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 using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Xml; using System.Collections; namespace SilverlightApplication13 { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); ReturnDate(t, 30, 60); } public TextBox t; public void ReturnDate(TextBox t,double margin,double left) { t = new TextBox(); t.Margin = new Thickness(margin); t.Width = 100; t.Name = "rim"; t.SetValue(Canvas.LeftProperty, left); Button b = new Button(); b.Width = 60; b.Height = 20; b.Content="ok"; b.Margin = new Thickness(margin); b.SetValue(Canvas.LeftProperty, left + 130); b.Click+=new RoutedEventHandler(b_Click); LayoutRoot.Children.Add(t); LayoutRoot.Children.Add(b); } public void b_Click(object sender, EventArgs e) { Calendar c = new Calendar(); c.SelectedDatesChanged+=new EventHandler<SelectionChangedEventArgs>(c_SelectedDatesChanged); c.Visibility = Visibility.Visible; LayoutRoot.Children.Add(c); } public void c_SelectedDatesChanged(object sender, EventArgs e) { TextBox t = (TextBox)sender; Calendar c = (Calendar)sender; t.Text = c.SelectedDates.ToString(); } } }
pouvez vous m'aider SVP je serai trop reconnaissante ..
Merci d'avance
Partager