bonjour afin d'eviter les repetition de code j'aimerai optimiser mon code suivant mais je ne sais pas comment mi prendre:
merci
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 Select Case True Case Me.J.Checked And Me.E.Checked And Me.Bo.Checked And Me.Rch_1.SelectedItem = "app" table1 = "Table_app" cmd.CommandText = String.Format("SELECT (Chm) from {0} WHERE [ID] =1", table1) If cnn.State = ConnectionState.Open Then cnn.Close() cnn.Open() ElseIf cnn.State = ConnectionState.Closed Then cnn.Open() End If Dim LectureUneInfo As OleDbDataReader = cmd.ExecuteReader While LectureUneInfo.Read() Xwmp = AxWindowsMediaPlayer1.newMedia(LectureUneInfo(0)) AxWindowsMediaPlayer1.currentPlaylist.insertItem(0, Xwmp) titre(LectureUneInfo(0)) End While LectureUneInfo.Close() Case Me.J.Checked And Me.E.Checked And Me.Bo.Checked And Me.Rch.SelectedItem = "Vo" table1 = "Table_VO" cmd.CommandText = String.Format("SELECT (Chm) from {0} WHERE [ID] =1", table1) If cnn.State = ConnectionState.Open Then cnn.Close() cnn.Open() ElseIf cnn.State = ConnectionState.Closed Then cnn.Open() End If Dim LectureUneInfo As OleDbDataReader = cmd.ExecuteReader While LectureUneInfo.Read() Xwmp = AxWindowsMediaPlayer1.newMedia(LectureUneInfo(0)) AxWindowsMediaPlayer1.currentPlaylist.insertItem(0, Xwmp) titre(LectureUneInfo(0)) End While LectureUneInfo.Close() Case Me.J.Checked And Me.E.Checked And Me.Bo.Checked And Me.Rch.SelectedItem = "Cons" table1 = "Table_CONS" cmd.CommandText = String.Format("SELECT (Chm) from {0} WHERE [ID] =1", table1) If cnn.State = ConnectionState.Open Then cnn.Close() cnn.Open() ElseIf cnn.State = ConnectionState.Closed Then cnn.Open() End If Dim LectureUneInfo As OleDbDataReader = cmd.ExecuteReader While LectureUneInfo.Read() Xwmp = AxWindowsMediaPlayer1.newMedia(LectureUneInfo(0)) AxWindowsMediaPlayer1.currentPlaylist.insertItem(0, Xwmp) titre(LectureUneInfo(0)) End While LectureUneInfo.Close() ......
Partager