bonjour,
je suis débutante dans la programmation avec VB6, et j'ai besoin d'aide,
je veux renvoyer les valeurs d'une fenêtre dans un tableau se trouvant dans une autre fenêtre.
est ce que quelqu'un peut m'aider?
merci
bonjour,
je suis débutante dans la programmation avec VB6, et j'ai besoin d'aide,
je veux renvoyer les valeurs d'une fenêtre dans un tableau se trouvant dans une autre fenêtre.
est ce que quelqu'un peut m'aider?
merci
Bonsoir,
Plait-il ?
Entre le titre et la rédaction de la discussion, il y a plus d'une interrogation ....
C'est quoi, pour toi, un "tableau" qui se trouve dans une fenêtre, exactement ?
Et c'est quoi aussi, exactement, les "valeurs d'une fenêtre" ?
La précision s'impose, si tu veux que l'on évite des questions/réponses à l'infini...
Merci de faire cet effort.
voici mon code, pour le fenêtre 1:
voilà, donc les photo de ces fenêtres:
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248 Option Explicit Private Sub Command1_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command10_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command11_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command12_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command13_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command14_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command15_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command16_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command17_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command18_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command19_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command2_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command20_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command21_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command22_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command23_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command24_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command27_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command28_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command3_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command4_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command5_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command6_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command7_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command8_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Command9_Click() Load Form2 Form2.Show vbModeless End Sub Private Sub Form_Load() With G .Row = 0 .Col = 0 .Text = "N° DU PORT" .Col = 1 .Text = "SPEED/DUPLEX" .Col = 2 .Text = "PRIORITY" .Col = 3 .Text = "BROADCAST STORM FILTERING" .Col = 4 .Text = "FLOW CONTROL" .Col = 5 .Text = "TRUNK" .Col = 6 .Text = "MODULE CARD EXIST" .Col = 7 .Text = "PORT DISABLED" .Col = 0 .Row = 1 .Text = "PORT 1" .Row = 2 .Text = "PORT 2" .Row = 3 .Text = "PORT 3" .Row = 4 .Text = "PORT 4" .Row = 5 .Text = "PORT 5" .Row = 6 .Text = "PORT 6" .Row = 7 .Text = "PORT 7" .Row = 8 .Text = "PORT 8" .Row = 9 .Text = "PORT 9" .Row = 10 .Text = "PORT 10" .Row = 11 .Text = "PORT 11" .Row = 12 .Text = "PORT 12" .Row = 13 .Text = "PORT 13" .Row = 14 .Text = "PORT 14" .Row = 15 .Text = "PORT 15" .Row = 16 .Text = "PORT 16" .Row = 17 .Text = "PORT 17" .Row = 18 .Text = "PORT 18" .Row = 19 .Text = "PORT 19" .Row = 20 .Text = "PORT 20" .Row = 21 .Text = "PORT 21" .Row = 22 .Text = "PORT 22" .Row = 23 .Text = "PORT 23" .Row = 24 .Text = "PORT 24" .Row = 25 .Text = "PORT 25" .Row = 26 .Text = "PORT 26" End With G.ColWidth(0) = 1400 G.ColWidth(1) = 2000 G.ColWidth(2) = 1000 G.ColWidth(3) = 3000 G.ColWidth(4) = 1400 G.ColWidth(5) = 1000 G.ColWidth(6) = 2000 G.ColWidth(7) = 1400 End Sub et pour le deuxième fenêtre: Option Explicit Private Sub List1_Click() End Sub Private Sub VScroll1_Change() End Sub Private Sub Combo1_GotFocus() Combo1.ListIndex = 1 End Sub Private Sub Combo1_Change() Lab_Saisie = Combo1.Text End Sub Private Sub Command1_Click() End Sub Private Sub Form_Load() Option2.Enabled = False Check2.Enabled = False Option8.Enabled = False Combo1.List(0) = "Low" Combo1.List(1) = "High" Combo2.List(0) = "Low" Combo2.List(1) = "High" End Sub
ma question c que je veus que quand je clique sur les option qui se trouve dans f2, ils s'affichent directement dans le tavleau associé dans f2
j'éspère que vous m'avez compris ( c'est une interface qui va gérer un switch)
Euh ...
Je ne vais pas aller plus loin dans l'examen de ce que tu nous montres là !!!
1) Au bout du compte, déjà, après toute cette drôle d'avalanche dans le With de G :
G.Col = 0
G.Row = 26
et
G.Text = "PORT 26"
!!!!
2) un groupe de contrôle indexés remplacerait tous tes :
qui, de surcroît, font rigoureusement la même chose !!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 Private Sub Commandn_Click() Load Form2 Form2.Show vbModeless End Sub
Tout celà est .... trop fort pour moi ...
Je cède donc la place aux spécialistes.....
je vous ai dit que je suis débutante
donc il y a pas de résolution à ce problème!!!
Bien que ce site ne soit pas dédié à l'apprentissage de vb, je vais essayer de t'apprendre quelques trucs
d'abord, dans la Feuille 1, suprimes tes composants Command2 à command26
dans les propriétes du command1, met la valeur index à zéro
renomme ta grille en MsFlexGrid1 (c'a c'est pour eviter de réécrire le code que je viens de faire)
revient dans le code et remplace le par celui-ci
Dans la feuille deux, j'ai utilisé deux textbox pour simplifier
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 Option Explicit Private Sub Command1_Click(Index As Integer) 'charger la fenetre de parametrage Load Form2 With MSFlexGrid1 .Col = Index .Row = 1 Form2.txtVitesse = .Text ' a adapter .Row = 2 Form2.txtPriority = .Text ' a adapter End If End With Form2.Show vbModal 'on attend que la fenetre soit feremée avant de continuer 'lire les resultat With MSFlexGrid1 If Form2.Ok Then .Col = Index .Row = 1 .Text = Form2.txtVitesse ' a adapter .Row = 2 .Text = Form2.txtPriority ' a adapter End If End With 'decharger form2 Unload Form2 Set Form2 = Nothing End Sub Private Sub Form_Load() Dim iPnt As Integer Dim posX As Long Dim PosY As Long 'Initialisation du flexgrid With MSFlexGrid1 .Cols = 8 .Rows = 26 .ColWidth(0) = 1400 .ColWidth(1) = 2000 .ColWidth(2) = 1000 .ColWidth(3) = 3000 .ColWidth(4) = 1400 .ColWidth(5) = 1000 .ColWidth(6) = 2000 .ColWidth(7) = 1400 .Row = 0 .Col = iPnt .Text = "N° DU PORT" .Col = 1 .Text = "SPEED/DUPLEX" .Col = 2 .Text = "PRIORITY" .Col = 3 .Text = "BROADCAST STORM FILTERING" .Col = 4 .Text = "FLOW CONTROL" .Col = 5 .Text = "TRUNK" .Col = 6 .Text = "MODULE CARD EXIST" .Col = 7 .Text = "PORT DISABLED" For iPnt = 1 To 26 .Col = 0 .Row = 1 .Text = "PORT " & CStr(iPnt) Next End With 'initialisation des boutons de commande Command1(0).Visible = False For iPnt = 1 To 26 'charger un nouveau composant command1 Load Command1(iPnt) 'positionner le nouveau bouton If iPnt < 14 Then posX = iPnt * Command1(0).Width PosY = Command1(0).Top Else posX = (iPnt - 13) * Command1(0).Width PosY = Command1(0).Top + Command1(0).Height End If Command1(iPnt).Move posX, PosY 'mettre à jour le caption Command1(iPnt).Caption = "P" & CStr(iPnt) 'rendre le composant visible Command1(iPnt).Visible = True Next End Sub
txtVitesse et txtPriority
et deux boutons de command : cmdOk et cmdCancel
Voici le code de base de la form2
Maintenant etudies bien le code que je viens de donner et comprends. Quand tu auras compris, tu seras passé de programmeur débutant à programmeur debutant chef !
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 Option Explicit Public Ok As Boolean Private Sub cmdCancel_Click() Ok = False Me.Hide End Sub Private Sub cmdOk_Click() Ok = True Me.Hide End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) If UnloadMode = vbFormControlMenu Then 'l'opéateur à fzemé la fenetre par la croix 'on refuse le déchargement et on masque la fenetre Cancel = True Ok = False Me.Hide End If End Sub
Oui...
Bonjour et salut à Jean-Luc...
Moi, je préfèrerais qu'on ne mette pas la charrue avant les boeufs et que l'on s'intéresse aux bases avant d'aller vers des composaants....
Les bases vont être ici l'étude de ce qu'est un Array...
On a compris ? ===>> on continue ===>> voyons le composant, maintenant :
La définition préalable de la ligne et de la colonne à traiter (dans une MsFlexGrid) ne sont indispensables que pour des mises en forme, pas pour des choses simples comme les dimensions ou le texte à insérer !!
Pour les dimensions : colwidth fait l'affaire...
Pour le Texte à insérer, on a directement TextMatrix...
Voilà donc comment, en conjuguant ces simples bases, on allège considérablement ... voyons ceci, donc :
Il est bon de prendre et d'apprendre les choses dans l'ordre dans lequel elles doivent être apprises.
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 Private Sub Form_Activate() Dim i As Integer, largeurs, titres largeurs = Array(1400, 2000, 1000, 3000, 400, 1000, 2000, 1400) titres = Array("N° DU PORT", "SPEED/DUPLEX", "PRIORITY", "BROADCAST STORM FILTERING", "FLOW CONTROL", "MODULE CARD EXIST", "TRUNK", "PORT DISABLED") nbports = 27 MSFlexGrid1.Cols = UBound(largeurs) + 1 MSFlexGrid1.Rows = nbports + 1 For i = 0 To UBound(largeurs) MSFlexGrid1.ColWidth(i) = largeurs(i) MSFlexGrid1.TextMatrix(0, i) = titres(i) Next For i = 1 To nbports MSFlexGrid1.TextMatrix(i, 0) = "PORT " & i Next End Sub
Pour le reste.... j'y reviendrai... mais d'abord ceci (pour l'amour de VB et les remerciements qu'ils mérite pour exister).
merci bien pour vôtre aide,
j'ai fait une petit combinaison entre le premier et le deuxième code
mais le problème reste le même:
dans le codecomment revoyer les valeurs de la deuxième fenêtre dans la MSHFLEXGRID?
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 Private Sub Command1_Click(Index As Integer) 'charger la fenetre de parametrage Load Form2 With MSFlexGrid1 .Col = Index .Row = 1 Form2.Option2 = .Text ' a adapter .Row = 2 Form2.Frame2 = .Text ' a adapter End With Form2.Show vbModal 'on attend que la fenetre soit feremée avant de continuer 'lire les resultat 'decharger form2 Unload Form2 Set Form2 = Nothing End Sub
car quand je fais form2.option2 ça ne marche pas!!!!
peux-tu s'il te plait nous dire ce que signifierait selon toi et ce que tu voudrais faire de :
dans le with de ta MsFlexGrid lirs du chargement ??
Code : Sélectionner tout - Visualiser dans une fenêtre à part Form2.Option2 = .Text
Kif Kif en ce qui concerne le :
???
Code : Sélectionner tout - Visualiser dans une fenêtre à part Form2.Frame2 = .Text
On commencera alors peut-être à y voir un peu plus clair ....
Ton codeRegarde le code de Delbeke
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 Private Sub Command1_Click(Index As Integer) 'charger la fenetre de parametrage Load Form2 With MSFlexGrid1 .Col = Index .Row = 1 Form2.Option2 = .Text ' a adapter .Row = 2 Form2.Frame2 = .Text ' a adapter End With Form2.Show vbModal 'on attend que la fenetre soit feremée avant de continuer 'lire les resultat 'MAIS OU TU LIS LE RESULTAT ?????? POUR ACTUALSER MSFlexGrid1 'decharger form2 Unload Form2 Set Form2 = Nothing End SubAutrement dit, tu decharges Form2 avant d'avoir recuperé les informations qu'il contient.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 Form2.Show vbModal 'on attend que la fenetre soit feremée avant de continuer 'lire les resultat ********* D'ICI à **************** With MSFlexGrid1 If Form2.Ok Then .Col = Index .Row = 1 .Text = Form2.txtVitesse ' a adapter .Row = 2 .Text = Form2.txtPriority ' a adapter End If End With 'puis seulement decharger form2 *********** Là *************** Unload Form2 Set Form2 = Nothing
Vous avez un bloqueur de publicités installé.
Le Club Developpez.com n'affiche que des publicités IT, discrètes et non intrusives.
Afin que nous puissions continuer à vous fournir gratuitement du contenu de qualité, merci de nous soutenir en désactivant votre bloqueur de publicités sur Developpez.com.
Partager