Application de gestion de films

Soyez le premier à donner votre avis sur cette source.

Vue 13 347 fois - Téléchargée 1 940 fois

Description

Cette application permet de stocker des information sur les films et les artistes.
Elle utilise les technologie ADO (avec acces).
Elle se veut simple et concrete (permet aussi de gérer les prêts de films, leur support et la qualité)

Source / Exemple :


Option Explicit
Private adodc1 As MSAdodcLib.Adodc
Private pic As ListImage
Private Right_clic As Integer
Private Right_clic_x As Integer
Private Right_clic_y As Integer
Private Lst1_id_item_clic As Long

Private Sub Command1_Click()
Dim i, id_verif As Long
Text1(1) = Verif_texte(Text1(1))
'verifiction si pas de doublons des artistes
If Verif_liste_artiste(ListView1, id_verif) Then
    MsgBox (ListView1.ListItems.Item(id_verif) & " est en double.")
Else
    If Text1(1) <> "" And Combo1.ListIndex + 1 <> 0 And Combo2.ListIndex + 1 <> 0 Then
    With adodc1
            Text2 = Verif_texte(Text2)
            .Refresh
            .Recordset.Close
            .Recordset.Open "Update Film set Nom_film = '" & Text1(1) & "',Type_film = " & (CInt(Combo2.ListIndex) + 1) & ",App_film =" & (CInt(Combo1.ListIndex) + 1) & ",Grave_film=" & CInt(CheckBox1.Value) & ",Com_film='" & Text2 & "'" & ",Pret_film='" & Verif_texte(Text3) & "' where Id_film = " & Text1(0) & ""
            'suppression de toutes les information dans la table
            .Refresh
            .Recordset.Close
            .Recordset.Open "delete  * from tl_film_artiste where tl_id_film = " & Text1(0) & ""
            If ListView1.ListItems.Count <> 0 Then
                    'insertion des artistes dans la table tl_film_artiste
                        For i = 1 To ListView1.ListItems.Count
                            'If ListView1.ListItems(i).Checked Then
                            .Refresh
                            .Recordset.Close
                            .Recordset.Open "Insert INTO tl_film_artiste (tl_id_film,tl_id_artiste) values ( " & Text1(0) & "," & ListView1.ListItems(i).Tag & ")"
                            'End If
                        Next i
            End If
    End With
    Call M_ihm.Charg_tree(TreeView1, adodc1, CLng(Text1(0)), "F")
    ListView1.ListItems.Clear
    Text1(0).Text = ""
    Text1(1) = ""
    Text2 = ""
    Text3 = ""
    CheckBox1 = 0
    Command1.Enabled = False
    Else: MsgBox ("Veuillez mettre au moin " & Chr(10) & " - le nom du film" & Chr(10) & " - le type" & Chr(10) & " - l'appréciation")
    End If
End If
End Sub

Private Sub Command2_Click()
Dim i, id_verif As Long
Dim txt As String
'si c pour ajouter un nouveau = effacer les champs
If Command2.Caption = "Nouveau" Then
    Text1(0) = ""
    'test pour savoir si le titre du film est deja dans la base si oui alors efface sinon on laisse
   With adodc1
        .Refresh
        .Recordset.Close
        .Recordset.Open "Select * from Film where Nom_film= '" & Text1(1) & "'"
        If Not (.Recordset.BOF And .Recordset.EOF) Then
            Text1(1) = ""
        End If
    End With
    'Text1(1) = ""
    Text2 = ""
    ListView1.ListItems.Clear
    'Call M_ihm.ChargeLst(ListView1, "select * from Artiste order by Act_real,Nom_artiste", adodc1)
    With adodc1
        .Refresh
        .Recordset.Close
        .Recordset.Open "select max(Id_film) from Film"
        If Not (IsNull(.Recordset.Fields(0))) Then
            Text1(0) = .Recordset.Fields(0) + 1
        Else
            Text1(0) = 1
        End If
    End With
    Text3 = ""
    Command1.Enabled = False
    Command2.Caption = "Enregistrer"
    ListView1.Enabled = True
    CheckBox1.Value = False
    Combo2.ListIndex = 2
    Combo1.ListIndex = 2
Else
    ' c es le cas ou c enregistrer
    Text1(1) = Verif_texte(Text1(1))
    'verifictionsi pas de doublon
    If Verif_liste_artiste(ListView1, id_verif) Then
        MsgBox (ListView1.ListItems.Item(id_verif) & " est en double")
    Else
        If Text1(1) <> "" And Combo1.ListIndex + 1 <> 0 And Combo2.ListIndex + 1 <> 0 Then
            'MsgBox ("combo1 : " & Combo1.ListIndex & "combo2 : " & Combo2.ListIndex)
            With adodc1
                .Refresh
                .Recordset.Close
                .Recordset.Open "Select * from Film where Nom_film='" & Text1(1) & "'"
                If .Recordset.RecordCount <> 0 Then
                    MsgBox ("Ce film existe deja!")
                    Exit Sub
                Else
                    txt = ""
                    Call Film_like(Text1(1), txt, adodc1)
                    If txt <> "" Then
                        If MsgBox("Un ou plusieurs films sont presque similaires : " & Chr(13) & txt, vbOKCancel, "Films similaires") = 2 Then
                            Command2.Caption = "Nouveau"
                            ListView1.ListItems.Clear
                            Text1(0) = ""
                            Text1(1) = ""
                            Text2 = ""
                            ListView1.Enabled = False
                            Exit Sub
                        End If
                    End If
                    'insertion du film dans la table film
                    'verification du text2 quand meme
                    Text2 = Verif_texte(Text2)
                    .Refresh
                    .Recordset.Close
                    .Recordset.Open "INSERT INTO Film (Id_film, Nom_film, Type_film, App_film, Grave_film, Com_film,Pret_film) VALUES (" _
                    & Text1(0) & ",'" & Text1(1) & "'," & (CInt(Combo2.ListIndex) + 1) & "," & (CInt(Combo1.ListIndex) + 1) & "," & CInt(CheckBox1.Value) & ",'" & Text2 & "','" & Verif_texte(Text3) & "')"
                    'insertion des liens artistes
                    'msgbox(listview1.ListItems.Item(listview1.
                    End If
                If ListView1.ListItems.Count <> 0 Then
                    'insertion des artistes dans la table tl_film_artiste
                        For i = 1 To ListView1.ListItems.Count
                            'If ListView1.ListItems(i).Checked Then
                            .Refresh
                            .Recordset.Close
                            .Recordset.Open "Insert INTO tl_film_artiste (tl_id_film,tl_id_artiste) values ( " & Text1(0) & "," & ListView1.ListItems(i).Tag & ")"
                            'End If
                        Next i
                End If
                
                End With
            'mise a jour du treeView avec selection du film
            Call M_ihm.Charg_tree(TreeView1, adodc1, CLng(Text1(0)), "F")
            Command2.Caption = "Nouveau"
            ListView1.ListItems.Clear
            Text1(0) = ""
            Text1(1) = ""
            Text2 = ""
            ListView1.Enabled = False
            Combo2.ListIndex = 2
            Combo1.ListIndex = 2
        Else: MsgBox ("Veuillez mettre au moin " & Chr(10) & " - le nom du film" & Chr(10) & " - le type" & Chr(10) & " - l'appréciation")
        End If
    End If
End If
End Sub

Private Sub Form_Load()
Dim req As String
Dim i As Long

On Error GoTo error
Right_clic = 0
Lst1_id_item_clic = -1

Set adodc1 = Me.Controls.Add("MSAdodcLib.Adodc", "Adodc1")
Set adodc1.Container = Me
With adodc1
    .Visible = False
    .ConnectionString = connex_bd
    .CommandType = adCmdText
    .RecordSource = "select * from Apprec"
    .Refresh
End With
        
'appreciation
With adodc1
    .Refresh
    .Recordset.Close
    .Recordset.Open "select * from Apprec"
    If .Recordset.RecordCount > 0 Then
    .Recordset.MoveFirst
    While Not .Recordset.EOF
    Combo1.AddItem .Recordset.Fields(1), CInt(.Recordset.Fields(0) - 1)
    .Recordset.MoveNext
    Wend
    End If
End With
Combo1.Refresh
Combo1.ListIndex = 2
'type
With adodc1
    .Refresh
    .Recordset.Close
    .Recordset.Open "select * from Type"
    If .Recordset.RecordCount > 0 Then
    .Recordset.MoveFirst
    While Not .Recordset.EOF
    Combo2.AddItem .Recordset.Fields(1) & " " & .Recordset.Fields(2), CInt(.Recordset.Fields(0) - 1)
    .Recordset.MoveNext
    Wend
    End If
End With
Combo2.Refresh
Combo2.ListIndex = 2

'ListView1.CheckBoxes = True
'ListView1.View = lvwList

Set pic = ImageList1.ListImages.Add(1, "Bien", LoadPicture(App.path & "\Icones\Bien2.bmp"))
Set pic = ImageList1.ListImages.Add(2, "Bof", LoadPicture(App.path & "\Icones\Bof2.bmp"))
Set pic = ImageList1.ListImages.Add(3, "Null", LoadPicture(App.path & "\Icones\Null2.bmp"))
Set pic = ImageList1.ListImages.Add(4, "Bien_c", LoadPicture(App.path & "\Icones\Bien_c.bmp"))
Set pic = ImageList1.ListImages.Add(5, "Bof_c", LoadPicture(App.path & "\Icones\Bof_c.bmp"))
Set pic = ImageList1.ListImages.Add(6, "Null_c", LoadPicture(App.path & "\Icones\Null_c.bmp"))
Set pic = ImageList1.ListImages.Add(7, "Moyen", LoadPicture(App.path & "\Icones\Moyen.bmp"))
Set pic = ImageList1.ListImages.Add(8, "Moyen_c", LoadPicture(App.path & "\Icones\Moyen_c.bmp"))

Set TreeView1.ImageList = ImageList1
Call M_ihm.Charg_tree(TreeView1, adodc1)
'Call M_ihm.ChargeLst(ListView1, "select * from Artiste order by Act_real,Nom_artiste", adodc1)

'fait la couleur de la barre de menu et des barres de defilement
'Dim a As Border

'Set a = ActiveSheet.Border(0)
'a.Color = "&H00C0FFFF&"
Exit Sub
error:
    MsgBox "Erreur de chargement de la base de donnée. Veuillez refaire le fichier start.dat"
    End
End Sub

Private Sub Form_Unload(Cancel As Integer)
    On Error GoTo error
    'ecriture des variable dans le fichier
    Open App.path & "\start.dat" For Output As #1
    Print #1, "Start=" & start_enabled & ";"
    Print #1, "path_bd=" & path_bd & ";"
    Close #1
    Me.Controls.Remove ("ADODC1")
    Set adodc1 = Nothing
    End
error:
    MsgBox "Le fichier start.dat n'est pas dans le répertoire de l'application" & Chr(13) & "ou est corrompu."
    End
End Sub

Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Lst1_id_item_clic = Item.Index
End Sub

Private Sub Listview1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyDelete Then
    If Lst1_id_item_clic <> -1 Then
    'MsgBox ("ok")
    ListView1.ListItems.Remove (Lst1_id_item_clic)
    Lst1_id_item_clic = -1
    End If
End If
End Sub

Private Sub Mn_Ap_Click()
Frm_help.Show vbModal
End Sub

Private Sub Mn_Art_Click()
Dim t1 As String
Dim t2 As Long
Frm_art.Command1.Enabled = False
Frm_art.Command2.Enabled = True
Frm_art.Show vbModal
Call M_ihm.Charg_tree(TreeView1, adodc1)
'Call M_ihm.ChargeLst(ListView1, "select * from Artiste order by Act_real,Nom_artiste", adodc1)
'ListView1.ListItems.Clear
End Sub

Private Sub Mn_bd_act_Click()
MsgBox path_bd
End Sub

Private Sub Mn_change_Click()
Dim o As MSComDlg.CommonDialog
Dim tmq, tmp As String
Dim i As Long
    'initialisation de l'objet
    Set o = Me.Controls.Add("MSComDlg.CommonDialog", "Essai")
    o.InitDir = App.path
    o.Filter = "mdb|*.mdb"
    'Methode de l'objet
    o.ShowOpen
    If o.FileTitle <> "" Then
    'enregistre dans le fichier de depart
    path_bd = o.FileName
    Call M_ihm.Charg_tree(Frm_Film.TreeView1, adodc1)
    End If
    Me.Controls.Remove ("Essai")
    Set o = Nothing
End Sub

Private Sub Mn_import_Click()
Frm_bd_excel.Show vbModal
'Call M_ihm.ChargeLst(ListView1, "select * from Artiste order by Act_real,Nom_artiste", adodc1)
ListView1.ListItems.Clear
Text1(0) = ""
Text1(1) = ""
Text2 = ""
Frm_Film.Command1.Enabled = False
Frm_Film.Command2.Caption = "Nouveau"
Frm_Film.Command2.Enabled = True
Call M_ihm.Charg_tree(Frm_Film.TreeView1, adodc1)
End Sub

Private Sub Mn_Info_Click()
Frm_info.Show vbModal
End Sub

Private Sub Mn_popup_Click()
If Mn_popup.Checked Then
    Mn_popup.Checked = False
    start_enabled = "0"
Else
    Mn_popup.Checked = True
    start_enabled = "1"
End If
End Sub

Private Sub Mn_Pret_Click(Index As Integer)
Frm_pret.Show vbModal
End Sub

Private Sub Mn_quit_Click()
Unload Frm_Film
End Sub

Private Sub Mn_Rech_Click()
Frm_rech.Show vbModal
End Sub

Private Sub Mn_Sup_Click()
Frm_supp.Show vbModal
'Call M_ihm.ChargeLst(ListView1, "select * from Artiste order by Act_real,Nom_artiste", adodc1)
Frm_Film.ListView1.ListItems.Clear
Frm_Film.Text1(0) = ""
Frm_Film.Text1(1) = ""
Frm_Film.Text2 = ""
Frm_Film.Command1.Enabled = False
Frm_Film.Command2.Caption = "Nouveau"
Frm_Film.Command2.Enabled = True
End Sub

Private Sub Text3_GotFocus()
If CheckBox1.Value Then
Else
    MsgBox ("Il faut que le film soit gravé")
End If
End Sub

Private Sub TreeView1_AfterLabelEdit(Cancel As Integer, NewString As String)
Dim id As Long
If NewString <> "" And Not (TreeView1.SelectedItem Is Nothing) And TreeView1.SelectedItem.Children = 0 Then
    id = CLng(Right(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, Len(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key) - 1))
    ' si c un film
    If Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "F" Then
        With adodc1
            .Refresh
            .Recordset.Close
            .Recordset.Open "Update Film set Nom_film = '" & NewString & "' where Id_film = " & id & ""
        End With
    Else
        With adodc1
            .Refresh
            .Recordset.Close
            .Recordset.Open "Update Artiste set Nom_artiste = '" & NewString & "' where id_artiste=" & id & ""
        End With
    End If
End If
Call M_ihm.Charg_tree(TreeView1, adodc1)
End Sub

Private Sub TreeView1_Click()
Dim i, id_film, k As Integer
Dim req, id As String
Dim id_art As Long

'si il ya quelque chose et que pas noeud un root et que film
If Not (TreeView1.SelectedItem Is Nothing) Then
    If TreeView1.SelectedItem.Children = 0 Then
        If Not (TreeView1.Nodes(TreeView1.SelectedItem.Index).Text = "Films") Then
            If Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "F" Then
                If TreeView1.Nodes.Count <> 0 Then
                'MsgBox (TreeView1.Nodes(TreeView1.SelectedItem.Index).Key & _
                '"," & TreeView1.Nodes(TreeView1.SelectedItem.Index).Text)
                'affichage dans les zones de texte et des listview
                ListView1.Enabled = True
                
                'Call M_ihm.ChargeLst(ListView1, "select * from Artiste order by Act_real,Nom_artiste", adodc1)
                
                
                Command1.Enabled = True
                id_film = CLng(Right(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, Len(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key) - 1))
                Call M_ihm.ChargeLst(ListView1, "select * from Artiste where id_artiste in (select tl_id_artiste from tl_film_artiste where tl_id_film = " & id_film & ")", adodc1)
                
                With adodc1
                    'affichage  des caractéristiques des films dans la table film
                    .Refresh
                    .Recordset.Close
                    .Recordset.Open "select * from Film where Id_film=" & id_film & ""
                    Text1(0) = .Recordset(0)
                    Text1(1) = .Recordset(1)
                    If Not IsNull(.Recordset(6)) Then
                    Text3 = .Recordset(6)
                    Else
                    Text3 = ""
                    End If
                    Command2.Caption = "Nouveau"
                    Combo2.ListIndex = .Recordset(2) - 1
                    Combo1.ListIndex = .Recordset(3) - 1
                    Text2 = .Recordset(5)
                    CheckBox1.Value = .Recordset(4)
                     'affichage des artistes du films dans la list view
                     'Call M_ihm.ChargeLst(ListView1, adodoc1)
                    .Refresh
                    .Recordset.Close
                    .Recordset.Open "select * from Tl_film_artiste where tl_id_film = " & id_film & " "
                    If Not (.Recordset.BOF And .Recordset.EOF) Then
                    .Recordset.MoveFirst
                    While Not .Recordset.EOF
                        For i = 1 To ListView1.ListItems.Count
                            If ListView1.ListItems(i).Tag = CLng(.Recordset.Fields(1)) Then
                            ListView1.ListItems(i).Checked = True
                            End If
                        Next i
                        .Recordset.MoveNext
                    Wend
                    End If
                End With
                
                'MsgBox (TreeView1.SelectedItem.Index & "," & TreeView1.SelectedItem.Children)
                End If
            Else
                'cas ou c un artiste
                If Right_clic = 2 Then
                'MsgBox (TreeView1.Nodes(TreeView1.SelectedItem.Index).Key & " " & Right_clic_x & " " & Right_clic_y)
                'Me.ScaleX
                'MsgBox (Me.Left & " " & Me.Top)
                id_art = CLng(Right(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, Len(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key) - 1))
                Menu_right_clic.id_art = id_art
                If Frm_Film.Text1(0) = "" Then
                    Menu_right_clic.id_film = -1
                Else
                    Menu_right_clic.id_film = CLng(Frm_Film.Text1(0))
                End If
                Menu_right_clic.Left = Right_clic_x + Me.Left + 800
                Menu_right_clic.Top = Right_clic_y + Me.Top + 1100
                Menu_right_clic.Show
                End If
                'ListView1.ListItems.Clear
                'ListView1.Enabled = False
                'Command1.Enabled = False
                'Text1(0) = ""
                'Text1(1) = ""
                'Text2 = ""
            End If
        End If
    End If
End If

End Sub

'modifier un artiste
Private Sub TreeView1_DblClick()
Dim id_art As Long
If Not (TreeView1.SelectedItem Is Nothing) And TreeView1.SelectedItem.Children = 0 And (Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "R" Or Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "A") And TreeView1.Nodes(TreeView1.SelectedItem.Index).Text <> "Acteurs" And TreeView1.Nodes(TreeView1.SelectedItem.Index).Text <> "Réalisateurs" Then
    If TreeView1.Nodes.Count <> 0 Then
        id_art = CLng(Right(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, Len(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key) - 1))
        With adodc1
            .Refresh
            .Recordset.Close
            .Recordset.Open "select * from Artiste where Id_artiste=" & id_art & ""
            If Not (.Recordset.BOF And .Recordset.EOF) Then
                Frm_art.Text1(0) = .Recordset(0)
                Frm_art.Text1(1) = .Recordset(1)
                Frm_art.CheckBox1 = .Recordset(2)
                Frm_art.Command1.Enabled = True
                Frm_art.Command2.Enabled = False
                Frm_art.Show vbModal
                ' si c un acteur qui vient etre modifie =vrai
                .Refresh
                .Recordset.Close
                .Recordset.Open "select * from Artiste where Id_artiste=" & id_art & ""
            
                If .Recordset(2) Then
                    Call M_ihm.Charg_tree(TreeView1, adodc1, id_art, "A")
                Else
                    Call M_ihm.Charg_tree(TreeView1, adodc1, id_art, "R")
                End If
                'Call M_ihm.ChargeLst(ListView1, "select * from Artiste order by Act_real,Nom_artiste", adodc1)
            End If
        End With
End If
End If
End Sub

Private Sub TreeView1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim b As Integer
Dim id_selected As Long
If KeyCode = 46 And Not (TreeView1.SelectedItem Is Nothing) And TreeView1.SelectedItem.Children = 0 And (Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "A" Or Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "R" Or Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "F") And TreeView1.Nodes(TreeView1.SelectedItem.Index).Text <> "Acteurs" And TreeView1.Nodes(TreeView1.SelectedItem.Index).Text <> "Réalisateurs" And TreeView1.Nodes(TreeView1.SelectedItem.Index).Text <> "Films" Then
    'MsgBox (KeyCode & " " & Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) & " " & Mid(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 2, Len(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key) - 1))
    id_selected = CLng(Mid(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 2, Len(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key) - 1))
    If Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "R" Then
        b = MsgBox("Attenion : Vous allez supprimer un Realisateur", vbYesNo)
        '6 = vrai
        If b = 6 Then
        With adodc1
            .Refresh
            .Recordset.Close
            .Recordset.Open "delete  * from tl_film_artiste where tl_id_artiste = " & id_selected & ""
            .Refresh
            .Recordset.Close
            .Recordset.Open "delete  * from Artiste where id_artiste = " & id_selected & ""
        End With
        If TypeName(TreeView1.SelectedItem.Next) = "Nothing" Then
        id_selected = CLng(Mid(TreeView1.Nodes(TreeView1.SelectedItem.Previous.Index).Key, 2, Len(TreeView1.Nodes(TreeView1.SelectedItem.Previous.Index).Key) - 1))
        Else
        id_selected = CLng(Mid(TreeView1.Nodes(TreeView1.SelectedItem.Next.Index).Key, 2, Len(TreeView1.Nodes(TreeView1.SelectedItem.Next.Index).Key) - 1))
        End If
        Call M_ihm.Charg_tree(TreeView1, adodc1, id_selected, "R")
        
        End If
    Else
        If Left(TreeView1.Nodes(TreeView1.SelectedItem.Index).Key, 1) = "A" Then
        b = MsgBox("Attention : Vous allez supprimer un Acteur", vbYesNo)
        'MsgBox (b)
        If b = 6 Then
        With adodc1
            .Refresh
            .Recordset.Close
            .Recordset.Open "delete  * from tl_film_artiste where tl_id_artiste = " & id_selected & ""
            .Refresh
            .Recordset.Close
            .Recordset.Open "delete  * from Artiste where id_artiste = " & id_selected & ""
        End With
        If TypeName(TreeView1.SelectedItem.Next) = "Nothing" Then
        id_selected = CLng(Mid(TreeView1.Nodes(TreeView1.SelectedItem.Previous.Index).Key, 2, Len(TreeView1.Nodes(TreeView1.SelectedItem.Previous.Index).Key) - 1))
        Else
        id_selected = CLng(Mid(TreeView1.Nodes(TreeView1.SelectedItem.Next.Index).Key, 2, Len(TreeView1.Nodes(TreeView1.SelectedItem.Next.Index).Key) - 1))
        End If
        Call M_ihm.Charg_tree(TreeView1, adodc1, id_selected, "A")
        
        End If
        Else
        b = MsgBox("Attenion : Vous allez supprimer un Film", vbYesNo)
        'MsgBox (b)
        If b = 6 Then
        With adodc1
            .Refresh
            .Recordset.Close
            .Recordset.Open "delete  * from tl_film_artiste where tl_id_film = " & id_selected & ""
            .Refresh
            .Recordset.Close
            .Recordset.Open "delete  * from Film where id_film = " & id_selected & ""
        End With
        If TypeName(TreeView1.SelectedItem.Next) = "Nothing" Then
        id_selected = CLng(Mid(TreeView1.Nodes(TreeView1.SelectedItem.Previous.Index).Key, 2, Len(TreeView1.Nodes(TreeView1.SelectedItem.Previous.Index).Key) - 1))
        Else
        id_selected = CLng(Mid(TreeView1.Nodes(TreeView1.SelectedItem.Next.Index).Key, 2, Len(TreeView1.Nodes(TreeView1.SelectedItem.Next.Index).Key) - 1))
        End If
        Call M_ihm.Charg_tree(TreeView1, adodc1, id_selected, "F")
        'Call M_ihm.ChargeLst(ListView1, "select * from artiste order by act_real,Nom_artiste", adodc1)
        ListView1.ListItems.Clear
        Command1.Enabled = False
        Text1(0) = ""
        Text1(1) = ""
        End If
        End If
    End If
End If

End Sub

Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Right_clic = Button
Right_clic_x = X
Right_clic_y = Y
End Sub

Conclusion :


Rien de très novateur, mais elle me sert bien.

Codes Sources

A voir également

Ajouter un commentaire Commentaires
Messages postés
31
Date d'inscription
mardi 11 mars 2008
Statut
Membre
Dernière intervention
3 novembre 2014

salut boukake , ta source et bonne j'aime, en plus simple
bon boulot
j me suis inspiré pour faire un projet qui lui ressemble
jette un coup d'oeil malgré que c'est manquant(je ferais las mises a jour bientot)
on pourrait s'échanger des idées
bonne continuation(7) de ma part
Messages postés
3
Date d'inscription
mercredi 17 janvier 2007
Statut
Membre
Dernière intervention
12 mai 2008

C'est vraiment rudimentaire :-(
Pas de gestion d'affiche de film ou de recherche de film via internet
M'enfin, pour les débutant ça peut servir d'exemple...
Encouragement quand même :-)
Messages postés
74
Date d'inscription
dimanche 2 avril 2006
Statut
Membre
Dernière intervention
23 juin 2010

Microsoft a publié un starter kit de médiatheque (fourni avec visual basic express 2005)
Messages postés
4822
Date d'inscription
lundi 11 novembre 2002
Statut
Membre
Dernière intervention
15 novembre 2016
13
Re,

Essaye comme cela dans tes requêtes INSERT INTO pour le titre du film(et voir pour d'autres champs succeptible d'avoir un apostrophe) :

'" & Replace(Text1(1).Text, "'", "''") & "'

A+
Exploreur
Messages postés
17286
Date d'inscription
mercredi 2 janvier 2002
Statut
Modérateur
Dernière intervention
23 décembre 2019
68
l''arnaque (deux quotes) et c'est bon ...
Afficher les 11 commentaires

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.