IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

probleme de declaration de type de colonne


Sujet :

VB.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre à l'essai
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Novembre 2018
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Vendée (Pays de la Loire)

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux

    Informations forums :
    Inscription : Novembre 2018
    Messages : 4
    Par défaut probleme de declaration de type de colonne
    Bonjour a tous,
    Je rencontre actuellement un problème , j'ai déclarer un DGV en readonly et colonnes que j'ajoute ensuite au DGV

    Lorsque je lance mon projet mes colonnes combobox et image apparaissent comme de vulgaire colonnes textbox , j'ai beau tourner dans tous les sens je ne trouve pas d'ou vient le problème.
    J'imagine que çà doit être tout bête mais le style des colonnes ne semble pas fonctionner

    Voici mon
    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
        ReadOnly MNU_CSB_2_4_1_2_2_DATAGRIDVIEW As New DataGridView With {
                .RowHeadersVisible = False,
                .ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize,
                .AllowUserToAddRows = False,
                .AllowUserToDeleteRows = False,
                .AllowUserToOrderColumns = False,
                .AllowUserToResizeColumns = False,
                .BackColor = SystemColors.Control,
                .BackgroundColor = SystemColors.Control,
                .BorderStyle = BorderStyle.None,
                .EnableHeadersVisualStyles = False,
                .Visible = True}
        ReadOnly MNU_CSB_2_4_1_2_2_1_COL_UID_CSB_INV As New DataGridViewTextBoxColumn
        ReadOnly MNU_CSB_2_4_1_2_2_2_COL_DSG_CSB_INV As New DataGridViewTextBoxColumn
        ReadOnly MNU_CSB_2_4_1_2_2_3_COL_QTE_ALL_CSB_INV As New DataGridViewTextBoxColumn
     
     
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns.Add("MNU_USR_2_4_1_2_2_1_COL_ID_CSB", "ID du consommable")
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_1_COL_ID_CSB").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_1_COL_ID_CSB").Width = 250
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns.Add("MNU_USR_2_4_1_2_2_2_COL_DSG_CSB", "Designation du consommable")
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_2_COL_DSG_CSB").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_2_COL_DSG_CSB").Width = 250
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns.Add("MNU_USR_2_4_1_2_2_3_COL_QTE_ALL", "Quantite allouee")
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_3_COL_QTE_ALL").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_3_COL_QTE_ALL").Width = 75
     
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns.Add("MNU_USR_2_4_1_2_2_1_COL_ID_CSB", "ID du consommable")
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_1_COL_ID_CSB").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_1_COL_ID_CSB").Width = 250
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns.Add("MNU_USR_2_4_1_2_2_2_COL_DSG_CSB", "Designation du consommable")
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_2_COL_DSG_CSB").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_2_COL_DSG_CSB").Width = 250
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns.Add("MNU_USR_2_4_1_2_2_3_COL_QTE_ALL", "Quantite allouee")
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_3_COL_QTE_ALL").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
            MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_USR_2_4_1_2_2_3_COL_QTE_ALL").Width = 75
     
        Dim MNU_CSB_2_4_1_2_2_4_COL_QTE_INV_PRS_GRD_VSAV As New DataGridViewComboBoxColumn With {
            .DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox,
            .DropDownWidth = 1,
            .MaxDropDownItems = 8,
            .FlatStyle = FlatStyle.Flat,
            .DisplayStyleForCurrentCellOnly = False}
        MNU_CSB_2_4_1_2_2_4_COL_QTE_INV_PRS_GRD_VSAV.Items.AddRange(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
        MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns.Add("MNU_CSB_2_4_1_2_2_4_COL_QTE_INV_PRS_GRD_VSAV", MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Tag.ToString)
        MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_CSB_2_4_1_2_2_4_COL_QTE_INV_PRS_GRD_VSAV").AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader
        Dim MNU_CSB_2_4_1_2_2_5_COL_ETT_INV_PRS_GRD_VSAV As New DataGridViewImageColumn
        MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns.Add("MNU_CSB_2_4_1_2_2_5_COL_ETT_INV_PRS_GRD_VSAV", "Etat")
        MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_CSB_2_4_1_2_2_5_COL_ETT_INV_PRS_GRD_VSAV").Width = 25
        MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Size = New System.Drawing.Point(580 + MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.RowHeadersWidth + 
        MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Columns("MNU_CSB_2_4_1_2_2_4_COL_QTE_INV_PRS_GRD_VSAV").Width, (MNU_CSB_2_4_1_2_2_DATAGRIDVIEW.Rows(0).Height * 18) + 14)
    Merci par avance de vos réponses

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    169
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 169
    Par défaut
    Il y a un souci avec tes lignes 18 à 36. Tu les déclares comme des colonnes de type par défaut.

    Voici le code qui marche très bien:
    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
    ReadOnly DGV As New DataGridView With {
                .RowHeadersVisible = False,
                .ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize,
                .AllowUserToDeleteRows = False,                           'j'ai retiré ".AllowUserToAddRows = False,"   pour mon exemple
                .AllowUserToOrderColumns = False,
                .AllowUserToResizeColumns = False,
                .BackColor = SystemColors.Control,
                .BackgroundColor = SystemColors.Control,
                .BorderStyle = BorderStyle.None,
                .Visible = True}
     
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
     
    Dim DGVColCombo As New DataGridViewComboBoxColumn With {
                .Name = "MNU_USR_2_4_1_2_2_3_COL_QTE_ALL",
                .HeaderText = "Quantite allouee",
                .Width = 250,
                .DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox,
                .DropDownWidth = 1,
                .MaxDropDownItems = 8,
                .FlatStyle = FlatStyle.Flat,
                .DisplayStyleForCurrentCellOnly = True}
    DGVColCombo.Items.AddRange("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20")       'mettre des strings au lieu d'entiers
    DGV.Columns.Add(DGVColCombo)
    DGV.Columns("MNU_USR_2_4_1_2_2_3_COL_QTE_ALL").AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader
     
     
    DGV.Rows.Add()     ' permet de tester la fonctionalité du combo
     
    End Sub

Discussions similaires

  1. [SP-2010] probleme de type de colonne dans une vue
    Par Fred06 dev dans le forum SharePoint
    Réponses: 7
    Dernier message: 26/12/2013, 11h09
  2. Modifier Type de colonnes
    Par klael dans le forum Paradox
    Réponses: 6
    Dernier message: 25/05/2007, 16h50
  3. Enorme probleme avec modification de type de colonne
    Par tibere dans le forum Administration
    Réponses: 2
    Dernier message: 07/04/2007, 13h57
  4. [LG]Problême Variable dynamique de types différents
    Par pierrOPSG dans le forum Langage
    Réponses: 2
    Dernier message: 29/04/2004, 16h01
  5. [Traduction] probleme de declaration
    Par Mercilius dans le forum Langage
    Réponses: 3
    Dernier message: 03/04/2003, 16h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo