Bonjour
Désolé si la question a déjà été posée mais je ne l'ai pas trouvé
Comme c'est indiqué, je débute avec WPF donc soyez indulgents.
Mon problème est le suivant. J'ai un form principal qui contient plusieurs textbox et une form secondaire qui s'ouvre dans certaines conditions.
J'ai réussi à afficher la seconde form en l'appelant depuis le form principal, mais je suis dans l'incapacité de renvoyer les informations sélectionnées dans cette form vers ma form principale.
(j'espère avoir été assez clair )
Voila mon code
form principale (je n'ai laissé que la textbox concernée)
code pour la form secondaire
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 <Window x:Class="gaz" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Arcalia Gaz :Etat de linstallation intérieure de gaz" Height="700" Width="1077" Name="diaggaz"> <Grid Background="LightBlue" Width="1073"> <!--panel pour les informations--> <StackPanel Name="panel_data" Width="230" HorizontalAlignment="Left" Margin="0,0,0,74"> <!--groupbox pour les informations du demandeur--> <GroupBox Name="gb_demandeur" Width="225" Height="130" BorderBrush="Black"> <Grid Height="130" Width="225"> [...] <Label HorizontalAlignment="Left" Width="75" Height="22" VerticalAlignment="top" Margin="0,60,0,0" Content="Commune"/> <TextBox Height="18" VerticalAlignment="Top" Margin="70,65,17,0" Name="txt_commune" BorderBrush="Black" /> [...] </Grid> </GroupBox> </StackPanel> </Window>
code qui doit normalement remplir la textbox de la premiere form avec l'element selectionné dans la listbox de la seconde form
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <Window x:Class="ville" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ville" Height="300" Width="300"> <Grid Background="LightBlue"> <Label Height="30" Width="300" FontSize="15" VerticalAlignment="Top" Content="Liste des villes"/> <ListBox Height="200" BorderBrush="Black" Name="lstville"/> <Button Name="btn_ok" Height="30" VerticalAlignment="Bottom" Background="AliceBlue" BorderBrush="Black" Content="Valider"/> </Grid> </Window>
et l'erreur que je recoit dans les dents en retour :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 Public Sub btn_ok_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_ok.Click [...] gaz.txt_commune.Content = lstville.SelectedItem.ToString [...] End Sub
Dans l'attente de votre aideError 1 Reference to a non-shared member requires an object reference. C:\Documents and Settings\YLN\Mes documents\Visual Studio 2008\Projects\DiagGaz\DiagGaz\ville.xaml.vb 10 13 DiagGaz
Cordialement
Nasty
Partager