Code couleur en html

Résolu
cs_tomalex1 Messages postés 29 Date d'inscription mercredi 10 février 2010 Statut Membre Dernière intervention 22 septembre 2011 - 28 nov. 2010 à 11:54
cs_tomalex1 Messages postés 29 Date d'inscription mercredi 10 février 2010 Statut Membre Dernière intervention 22 septembre 2011 - 28 nov. 2010 à 14:13
Bonjour,
j'ai créer un form contenant un bouton, un textbox et un colorDialog que je clic sur le bouton le colorDialog s'affiche et quand je choisi une couleur ca rempli le textbox avec la couleur que j'ai choisi mais moi je voudrai que ca m'affiche le code de la couleur choisi dans le textbox
(en html ex:"00FF00" pour le vert)
Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
        Dim result As DialogResult = ColorDialog1.ShowDialog()
        If (result.Equals(DialogResult.OK)) Then
'En dessou ca change la couleur du textbox            
TextBox1.BackColor = ColorDialog1.Color
        End If
    End Sub

j'ai voulu faire comme ca :
Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click
        Dim result As DialogResult = ColorDialog1.ShowDialog()
        If (result.Equals(DialogResult.OK)) Then
'En dessou ca m'affiche une erreur            
TextBox1.text = ColorDialog1.Color
        End If
    End Sub

voila j'espère que quelqu'un poura m'aider dans ma recherche
merci d'avance

4 réponses

cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
28 nov. 2010 à 13:25
Devrait aller :
MsgBox((ColorDialog1.Color.ToArgb() And &HFFFFFF&).ToString("X"))


VB.NET is good ... VB6 is better
Utilise Réponse acceptée quand un post répond à ta question
3
cs_tomalex1 Messages postés 29 Date d'inscription mercredi 10 février 2010 Statut Membre Dernière intervention 22 septembre 2011
28 nov. 2010 à 14:13
c'est bon j'ai trouver ^^
j'ai remplacer
ColorDialog1.Color.ToArgb()
par
MyDialog.Color.ToArgb()
3
cs_tomalex1 Messages postés 29 Date d'inscription mercredi 10 février 2010 Statut Membre Dernière intervention 22 septembre 2011
28 nov. 2010 à 11:55
pour info j'utilise Visual Basic 2008 Express
0
cs_tomalex1 Messages postés 29 Date d'inscription mercredi 10 février 2010 Statut Membre Dernière intervention 22 septembre 2011
28 nov. 2010 à 13:55
J'ai éssayé quelque methode avec ta réponse ghuysmans99
' ca m"affiche 1 dans la msgbox et 0 dans le textbox1
TextBox1.BackColor = MsgBox((ColorDialog1.Color.ToArgb() And &HFFFFFF&).ToString("X"))
' ca m'affiche -16777216 dans le textbox1
TextBox1.BackColor = ColorDialog1.Color.ToArgb()
' ca m'affiche 0 dans le textbox1
TextBox1.BackColor = (ColorDialog1.Color.ToArgb() And &HFFFFFF&)
' et la ca m'affiche aussi 0 dans le textbox1
TextBox1.BackColor = (ColorDialog1.Color.ToArgb() And &HFFFFFF&).ToString("X")

tous ca en changent a chaque foie de couleur
0
Rejoignez-nous