Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

GENERATEUR DE MESSAGES BOXS


Information sur la source

Description

Cliquez pour voir la capture en taille normale
Un petit programme tres simple que je compte bien ameliorer en un multi boxs generator
tous est dans le zip g quand meme mis le code mais bon vu le nombre de controles qu'il y a vous aurez du mal a la faire fonctioner sans telecharger le zip,
le code parait long mais c la meme chose c juste le nom de controle qui change
 

Source

  • Option Explicit
  • Dim v1, v2, v3, v4, v5, Title1, Picture1, Buton, v6, v7, v8, v9, v10, Title2, Pictur2, M As Integer
  • Private Sub Check1_Click()
  • If Check1.Value = 1 Then
  • Check1.Caption = "Beep On"
  • ElseIf Check1.Value = 0 Then
  • Check1.Caption = "Beep Off"
  • End If
  • End Sub
  • Private Sub Check2_Click()
  • If Check2.Value = 1 Then
  • Check2.Caption = "Masquer On"
  • ElseIf Check1.Value = 0 Then
  • Check2.Caption = "Masquer Off"
  • End If
  • End Sub
  • Private Sub form_load()
  • Option1(0).Value = True
  • Option3(2).Value = True
  • Option2(0).Value = True
  • End Sub
  • Private Sub Form_unload(cancel As Integer)
  • End
  • End Sub
  • Private Sub Command3_Click()
  • Unload Me
  • End Sub
  • 'generation de la msgbox
  • Private Sub Command1_Click()
  • If Option1(0).Value = True Then
  • Picture1 = vbQuestion
  • End If
  • If Option1(1).Value = True Then
  • Picture1 = vbInformation
  • End If
  • If Option1(2).Value = True Then
  • Picture1 = vbExclamation
  • End If
  • If Option1(3).Value = True Then
  • Picture1 = vbCritical
  • End If
  • If Option3(0).Value = True Then
  • Buton = vbYesNo
  • End If
  • If Option3(1).Value = True Then
  • Buton = vbYesNoCancel
  • End If
  • If Option3(2).Value = True Then
  • Buton = vbOKOnly
  • End If
  • If Option3(3).Value = True Then
  • Buton = vbOKCancel
  • End If
  • If Option3(5).Value = True Then
  • Buton = vbRetryCancel
  • End If
  • If Option3(6).Value = True Then
  • Buton = vbAbortRetryIgnore
  • End If
  • If Not Text1.Text = "" Then
  • Title1 = Text1.Text
  • End If
  • If Not Text2.Text = "" Then
  • v1 = Text2.Text & Chr(10)
  • ElseIf Text2.Text = "Ligne 1" Then
  • v1 = ""
  • Else
  • Resume Next
  • End If
  • If Not Text3.Text = "" Then
  • v2 = Text3.Text & Chr(10)
  • ElseIf Text3.Text = "Ligne 2" Then
  • v2 = ""
  • Else
  • Resume Next
  • End If
  • If Not Text4.Text = "" Then
  • v3 = Text4.Text & Chr(10)
  • ElseIf Text4.Text = "Ligne 3" Then
  • v3 = ""
  • Else
  • Resume Next
  • End If
  • If Not Text5.Text = "" Then
  • v4 = Text5.Text & Chr(10)
  • ElseIf Text5.Text = "Ligne 4" Then
  • v4 = ""
  • Else
  • Resume Next
  • End If
  • If Not Text6.Text = "" Then
  • v5 = Text6.Text
  • ElseIf Text6.Text = "Ligne 5" Then
  • v5 = ""
  • Else
  • Resume Next
  • End If
  • If Not Text1.Text = "" Then
  • If Not Text1.Text = "Titre" Then
  • If Not Text2.Text = "Ligne 1" Then
  • If Not Text3.Text = "Ligne 2" Then
  • If Not Text4.Text = "Ligne 3" Then
  • If Not Text5.Text = "Ligne 4" Then
  • If Not Text6.Text = "Ligne 5" Then
  • msg0:
  • Call mask
  • Call bep
  • M = MsgBox(v1 & v2 & v3 & v4 & v5, Buton + Picture1, Title1)
  • If M = vbRetry Then
  • GoTo msg0
  • End If
  • Me.Visible = True
  • Exit Sub
  • End If
  • msg1:
  • Call mask
  • Call bep
  • M = MsgBox(v1 & v2 & v3 & v4, Buton + Picture1, Title1)
  • If M = vbRetry Then
  • GoTo msg1
  • End If
  • Me.Visible = True
  • Exit Sub
  • End If
  • msg2:
  • Call mask
  • Call bep
  • M = MsgBox(v1 & v2 & v3, Buton + Picture1, Title1)
  • If M = vbRetry Then
  • GoTo msg2
  • End If
  • Me.Visible = True
  • Exit Sub
  • End If
  • msg3:
  • Call mask
  • Call bep
  • M = MsgBox(v1 & v2, Buton + Picture1, Title1)
  • If M = vbRetry Then
  • GoTo msg3
  • End If
  • Me.Visible = True
  • Exit Sub
  • End If
  • msg4:
  • Call mask
  • Call bep
  • M = MsgBox(v1, Buton + Picture1, Title1)
  • Me.Visible = True
  • If M = vbRetry Then
  • GoTo msg4
  • End If
  • Exit Sub
  • End If
  • Me.Visible = True
  • MsgBox "Vous devez paramètrer le reste de la boite de dialogue !!", vbOKOnly + vbCritical, "Attention"
  • Me.Visible = True
  • Exit Sub
  • Else
  • Me.Visible = True
  • MsgBox "Vous devez ecrire un titre pour votre boite de dialogue !!", vbOKOnly + vbCritical, "Attention"
  • Me.Visible = True
  • Exit Sub
  • End If
  • Me.Visible = True
  • MsgBox "Vous devez paramètrer une boite de dialogue !!", vbOKOnly + vbCritical, "Attention"
  • Me.Visible = True
  • Exit Sub
  • End If
  • End Sub
  • Private Sub mask()
  • If Check2.Value = 1 Then
  • Me.Visible = False
  • ElseIf Check1.Value = 2 Then
  • Me.Visible = True
  • End If
  • End Sub
  • Private Sub bep()
  • If Check1.Value = 1 Then
  • Beep
  • Beep
  • Beep
  • End If
  • End Sub
  • 'textboxs de la frame1
  • Private Sub Text1_Click()
  • If Text1.Text = "Titre" Then
  • Text1.Text = ""
  • End If
  • End Sub
  • Private Sub Text1_gotfocus()
  • Call Text1_Click
  • End Sub
  • Private Sub Text2_Click()
  • If Text2.Text = "Ligne 1" Then
  • Text2.Text = ""
  • End If
  • End Sub
  • Private Sub Text2_gotfocus()
  • Call Text2_Click
  • End Sub
  • Private Sub Text3_Click()
  • If Text3.Text = "Ligne 2" Then
  • Text3.Text = ""
  • End If
  • End Sub
  • Private Sub Text3_gotfocus()
  • Call Text3_Click
  • End Sub
  • Private Sub Text4_Click()
  • If Text4.Text = "Ligne 3" Then
  • Text4.Text = ""
  • End If
  • End Sub
  • Private Sub Text4_gotfocus()
  • Call Text4_Click
  • End Sub
  • Private Sub Text5_Click()
  • If Text5.Text = "Ligne 4" Then
  • Text5.Text = ""
  • End If
  • End Sub
  • Private Sub Text5_gotfocus()
  • Call Text5_Click
  • End Sub
  • Private Sub Text6_Click()
  • If Text6.Text = "Ligne 5" Then
  • Text6.Text = ""
  • End If
  • End Sub
  • Private Sub Text6_gotfocus()
  • Call Text6_Click
  • End Sub
  • Private Sub Text1_LostFocus()
  • If Text1.Text = "" Then
  • Text1.Text = "Titre"
  • End If
  • End Sub
  • Private Sub Text2_LostFocus()
  • If Text2.Text = "" Then
  • Text2.Text = "Ligne 1"
  • End If
  • End Sub
  • Private Sub Text3_LostFocus()
  • If Text3.Text = "" Then
  • Text3.Text = "Ligne 2"
  • End If
  • End Sub
  • Private Sub Text4_LostFocus()
  • If Text4.Text = "" Then
  • Text4.Text = "Ligne 3"
  • End If
  • End Sub
  • Private Sub Text5_LostFocus()
  • If Text5.Text = "" Then
  • Text5.Text = "Ligne 4"
  • End If
  • End Sub
  • Private Sub Text6_LostFocus()
  • If Text6.Text = "" Then
  • Text6.Text = "Ligne 5"
  • End If
  • End Sub
  • 'textboxs de la frame2 (non exploitée !)
  • Private Sub Text7_Click()
  • If Text7.Text = "Titre" Then
  • Text7.Text = ""
  • End If
  • End Sub
  • Private Sub Text7_gotfocus()
  • Call Text7_Click
  • End Sub
  • Private Sub Text8_Click()
  • If Text8.Text = "Ligne 1" Then
  • Text8.Text = ""
  • End If
  • End Sub
  • Private Sub Text8_gotfocus()
  • Call Text8_Click
  • End Sub
  • Private Sub Text9_Click()
  • If Text9.Text = "Ligne 2" Then
  • Text9.Text = ""
  • End If
  • End Sub
  • Private Sub Text9_gotfocus()
  • Call Text9_Click
  • End Sub
  • Private Sub Text10_Click()
  • If Text10.Text = "Ligne 3" Then
  • Text10.Text = ""
  • End If
  • End Sub
  • Private Sub Text10_gotfocus()
  • Call Text10_Click
  • End Sub
  • Private Sub Text11_Click()
  • If Text11.Text = "Ligne 4" Then
  • Text11.Text = ""
  • End If
  • End Sub
  • Private Sub Text11_gotfocus()
  • Call Text11_Click
  • End Sub
  • Private Sub Text12_Click()
  • If Text12.Text = "Ligne 5" Then
  • Text12.Text = ""
  • End If
  • End Sub
  • Private Sub Text12_gotfocus()
  • Call Text12_Click
  • End Sub
  • Private Sub Text7_LostFocus()
  • If Text7.Text = "" Then
  • Text7.Text = "Titre"
  • End If
  • End Sub
  • Private Sub Text8_LostFocus()
  • If Text8.Text = "" Then
  • Text8.Text = "Ligne 1"
  • End If
  • End Sub
  • Private Sub Text9_LostFocus()
  • If Text9.Text = "" Then
  • Text9.Text = "Ligne 2"
  • End If
  • End Sub
  • Private Sub Text10_LostFocus()
  • If Text10.Text = "" Then
  • Text10.Text = "Ligne 3"
  • End If
  • End Sub
  • Private Sub Text11_LostFocus()
  • If Text11.Text = "" Then
  • Text11.Text = "Ligne 4"
  • End If
  • End Sub
  • Private Sub Text12_LostFocus()
  • If Text12.Text = "" Then
  • Text12.Text = "Ligne 5"
  • End If
  • End Sub
Option Explicit
Dim v1, v2, v3, v4, v5, Title1, Picture1, Buton, v6, v7, v8, v9, v10, Title2, Pictur2, M As Integer
Private Sub Check1_Click()
If Check1.Value = 1 Then
Check1.Caption = "Beep On"
ElseIf Check1.Value = 0 Then
Check1.Caption = "Beep Off"
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Check2.Caption = "Masquer On"
ElseIf Check1.Value = 0 Then
Check2.Caption = "Masquer Off"
End If
End Sub
Private Sub form_load()
Option1(0).Value = True
Option3(2).Value = True
Option2(0).Value = True
End Sub
Private Sub Form_unload(cancel As Integer)
End
End Sub
Private Sub Command3_Click()
Unload Me
End Sub

'generation de la msgbox
Private Sub Command1_Click()

If Option1(0).Value = True Then
Picture1 = vbQuestion
End If
If Option1(1).Value = True Then
Picture1 = vbInformation
End If
If Option1(2).Value = True Then
Picture1 = vbExclamation
End If
If Option1(3).Value = True Then
Picture1 = vbCritical
End If

If Option3(0).Value = True Then
Buton = vbYesNo
End If
If Option3(1).Value = True Then
Buton = vbYesNoCancel
End If
If Option3(2).Value = True Then
Buton = vbOKOnly
End If
If Option3(3).Value = True Then
Buton = vbOKCancel
End If
If Option3(5).Value = True Then
Buton = vbRetryCancel
End If
If Option3(6).Value = True Then
Buton = vbAbortRetryIgnore
End If
If Not Text1.Text = "" Then
Title1 = Text1.Text
End If

If Not Text2.Text = "" Then
v1 = Text2.Text & Chr(10)
ElseIf Text2.Text = "Ligne 1" Then
v1 = ""
Else
Resume Next
End If

If Not Text3.Text = "" Then
v2 = Text3.Text & Chr(10)
ElseIf Text3.Text = "Ligne 2" Then
v2 = ""
Else
Resume Next
End If

If Not Text4.Text = "" Then
v3 = Text4.Text & Chr(10)
ElseIf Text4.Text = "Ligne 3" Then
v3 = ""
Else
Resume Next
End If

If Not Text5.Text = "" Then
v4 = Text5.Text & Chr(10)
ElseIf Text5.Text = "Ligne 4" Then
v4 = ""
Else
Resume Next
End If

If Not Text6.Text = "" Then
v5 = Text6.Text
ElseIf Text6.Text = "Ligne 5" Then
v5 = ""
Else
Resume Next
End If
If Not Text1.Text = "" Then
If Not Text1.Text = "Titre" Then
If Not Text2.Text = "Ligne 1" Then
    If Not Text3.Text = "Ligne 2" Then
        If Not Text4.Text = "Ligne 3" Then
            If Not Text5.Text = "Ligne 4" Then
                If Not Text6.Text = "Ligne 5" Then
msg0:
                Call mask
                Call bep
                M = MsgBox(v1 & v2 & v3 & v4 & v5, Buton + Picture1, Title1)
                If M = vbRetry Then
                GoTo msg0
                End If
                Me.Visible = True
                Exit Sub
                End If
msg1:
            Call mask
            Call bep
            M = MsgBox(v1 & v2 & v3 & v4, Buton + Picture1, Title1)
            If M = vbRetry Then
            GoTo msg1
            End If
            Me.Visible = True
            Exit Sub
            End If
msg2:
        Call mask
        Call bep
        M = MsgBox(v1 & v2 & v3, Buton + Picture1, Title1)
        If M = vbRetry Then
        GoTo msg2
        End If
        Me.Visible = True
        Exit Sub
        End If
msg3:
    Call mask
    Call bep
    M = MsgBox(v1 & v2, Buton + Picture1, Title1)
    If M = vbRetry Then
    GoTo msg3
    End If
    Me.Visible = True
    Exit Sub
    End If
msg4:
Call mask
Call bep
M = MsgBox(v1, Buton + Picture1, Title1)
Me.Visible = True
If M = vbRetry Then
GoTo msg4
End If
Exit Sub
End If
Me.Visible = True
MsgBox "Vous devez paramètrer le reste de la boite de dialogue !!", vbOKOnly + vbCritical, "Attention"
Me.Visible = True
Exit Sub
Else
Me.Visible = True
MsgBox "Vous devez ecrire un titre pour votre boite de dialogue !!", vbOKOnly + vbCritical, "Attention"
Me.Visible = True
Exit Sub
End If
Me.Visible = True
MsgBox "Vous devez paramètrer une boite de dialogue !!", vbOKOnly + vbCritical, "Attention"
Me.Visible = True
Exit Sub
End If
End Sub
Private Sub mask()
If Check2.Value = 1 Then
Me.Visible = False
ElseIf Check1.Value = 2 Then
Me.Visible = True
End If
End Sub
Private Sub bep()
If Check1.Value = 1 Then
Beep
Beep
Beep
End If
End Sub

'textboxs de la frame1

Private Sub Text1_Click()
If Text1.Text = "Titre" Then
Text1.Text = ""
End If
End Sub
Private Sub Text1_gotfocus()
Call Text1_Click
End Sub
Private Sub Text2_Click()
If Text2.Text = "Ligne 1" Then
Text2.Text = ""
End If
End Sub
Private Sub Text2_gotfocus()
Call Text2_Click
End Sub
Private Sub Text3_Click()
If Text3.Text = "Ligne 2" Then
Text3.Text = ""
End If
End Sub
Private Sub Text3_gotfocus()
Call Text3_Click
End Sub
Private Sub Text4_Click()
If Text4.Text = "Ligne 3" Then
Text4.Text = ""
End If
End Sub
Private Sub Text4_gotfocus()
Call Text4_Click
End Sub
Private Sub Text5_Click()
If Text5.Text = "Ligne 4" Then
Text5.Text = ""
End If
End Sub
Private Sub Text5_gotfocus()
Call Text5_Click
End Sub
Private Sub Text6_Click()
If Text6.Text = "Ligne 5" Then
Text6.Text = ""
End If
End Sub
Private Sub Text6_gotfocus()
Call Text6_Click
End Sub
Private Sub Text1_LostFocus()
If Text1.Text = "" Then
Text1.Text = "Titre"
End If
End Sub
Private Sub Text2_LostFocus()
If Text2.Text = "" Then
Text2.Text = "Ligne 1"
End If
End Sub
Private Sub Text3_LostFocus()
If Text3.Text = "" Then
Text3.Text = "Ligne 2"
End If
End Sub
Private Sub Text4_LostFocus()
If Text4.Text = "" Then
Text4.Text = "Ligne 3"
End If
End Sub
Private Sub Text5_LostFocus()
If Text5.Text = "" Then
Text5.Text = "Ligne 4"
End If
End Sub
Private Sub Text6_LostFocus()
If Text6.Text = "" Then
Text6.Text = "Ligne 5"
End If
End Sub

'textboxs de la frame2 (non exploitée !)

Private Sub Text7_Click()
If Text7.Text = "Titre" Then
Text7.Text = ""
End If
End Sub
Private Sub Text7_gotfocus()
Call Text7_Click
End Sub
Private Sub Text8_Click()
If Text8.Text = "Ligne 1" Then
Text8.Text = ""
End If
End Sub
Private Sub Text8_gotfocus()
Call Text8_Click
End Sub
Private Sub Text9_Click()
If Text9.Text = "Ligne 2" Then
Text9.Text = ""
End If
End Sub
Private Sub Text9_gotfocus()
Call Text9_Click
End Sub
Private Sub Text10_Click()
If Text10.Text = "Ligne 3" Then
Text10.Text = ""
End If
End Sub
Private Sub Text10_gotfocus()
Call Text10_Click
End Sub
Private Sub Text11_Click()
If Text11.Text = "Ligne 4" Then
Text11.Text = ""
End If
End Sub
Private Sub Text11_gotfocus()
Call Text11_Click
End Sub
Private Sub Text12_Click()
If Text12.Text = "Ligne 5" Then
Text12.Text = ""
End If
End Sub
Private Sub Text12_gotfocus()
Call Text12_Click
End Sub
Private Sub Text7_LostFocus()
If Text7.Text = "" Then
Text7.Text = "Titre"
End If
End Sub
Private Sub Text8_LostFocus()
If Text8.Text = "" Then
Text8.Text = "Ligne 1"
End If
End Sub
Private Sub Text9_LostFocus()
If Text9.Text = "" Then
Text9.Text = "Ligne 2"
End If
End Sub
Private Sub Text10_LostFocus()
If Text10.Text = "" Then
Text10.Text = "Ligne 3"
End If
End Sub
Private Sub Text11_LostFocus()
If Text11.Text = "" Then
Text11.Text = "Ligne 4"
End If
End Sub
Private Sub Text12_LostFocus()
If Text12.Text = "" Then
Text12.Text = "Ligne 5"
End If
End Sub
 

Conclusion

Bon si vous voulez pas le zip voici la liste des controles :
6 Textes boxs
4 images
2 bouton
2 frames
2 Checkboxs
2 groupes d'options (un de 4 et l'aute de 6)
et voila !
sinon tout est dans le zip !
 

Fichier Zip

Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip

Commentaires et avis

signaler à un administrateur
Commentaire de ShadowMan le 29/01/2002 21:54:10

Dire qu'ya des personnes qui ont assez de temps pour s'amuser à créer des petits programmes inutiles comme celui-là...
Y sert a quoi en fait

signaler à un administrateur
Commentaire de Urgo le 21/07/2003 14:36:23

Oui on pourrais en generer un executable seulement voila il foudrit un code source qui compile du vb !!

Voilà encore un nb qui sait pas programme mdr

Ajouter un commentaire

Discussions en rapport avec ce code source dans le forum

Message Box [ par xavier77 ] Salut, J'en ait un peu marre du MsgBox de VB, alors, j'ai donc décidé d'en créer un avec des nouvelles propriétés (couleur, des nouveau icones,...).J' Comment afficher plusieur message box ? [ par Mrx3 ] ... compatible vbscript . Quand je metMsgBox "texte1", ,"titre1"MsgBox "texte2", ,"titre2"Sa m'ouvre la première boite et apres la deuxieme, comment f Message Box non bloquante [ par Sapaya ] Voila, je voudrais savoir si c'est possible de faire une msgbox non bloquante.En bref, que le code situé apres l'appel de cet msgbox soit executé meme msgBox personnalisée [ par mickael3905 ] Bonjour,J'aimerais savoir s'il est possible de programmer une message box personnalisée.Cette message box aurait 2 boutons sur lesquels serait re message box [ par nana10 ] bonjour premierement bonne féte à tous les péres!!!!mon probléme c'est que je veux programmer en vb6un msgbox sous forme de combobox c'est à dire qu [vb.net]Message box oui/non [ par sisi35 ] Bonjour, Je voudrais avoir 2 boutons dans ma message box: "oui" et "non" et non pas "yes" et "no".Comment faire?Merci, Sylvie. lire le contenu d'un message box [ par CrazyMan19 ] salut tt le mondeje vx un bout d code qui me permitteras de lire le contenu d'un message box affiché par une application , et merçi :)Je suis né intel Envoyer un message distant [ par culie3 ] Bonjour, voila je voudrais avoir de l'aide pour savoir comment envoyer un message distant c'est à dire:Il y a 2 fichiers:-Le controle(sur votre ordi)- Probleme de msgbox [ par zizouth ] Salut,J'ai remarqué que lors qu'un affichage d'une msgbox le programme se met en pause jusqu'a qu'on appuis sur le buton ok (ou yes, no etc..) de la Envoyer une message box via winsock [ par alex_sex ] Be je pence que le titre est explicatif  Enfin voila je cherche a envoyer une msgbox au serveur, comment j'pourais faire ca? Merci :)


Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Téléchargements

Comparez les prix Nouvelle version

Photothèque Nouveau !



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,936 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.