Hello,
Voici une procédure d'initialisation d'un contrôle de type DataGridView :
Je définis 2 colonnes comme étant triable de manière automatique (tel qu'indiqué sur le site de la MSDN) mais rien ne se passe lors du clic sur le header de la colonne.
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 Private Sub InitDgvDemo() dgvPromoDetailDemo.AutoGenerateColumns = False dgvPromoDetailDemo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill Dim index As Integer With dgvPromoDetailDemo.Columns index = .Add("dgvcId", "Id") .Item(index).DataPropertyName = "Id" .Item(index).Visible = False index = .Add("dgvcCodeDemo", "Code") .Item(index).DataPropertyName = "CodeDemo" .Item(index).SortMode = DataGridViewColumnSortMode.Automatic index = .Add("dgvcVbn", "VBN") .Item(index).DataPropertyName = "Vbn" index = .Add("dgvcPercentage", "Percentage") .Item(index).DataPropertyName = "Percentage" .Item(index).SortMode = DataGridViewColumnSortMode.Automatic index = .Add("dgvcComment", "Comment") .Item(index).DataPropertyName = "Comment" index = .Add("dgvcNote", "Note") .Item(index).DataPropertyName = "Note" index = .Add("dgvcBuyingDept", "Buying Dept.") .Item(index).DataPropertyName = "BuyingDepartment" index = .Add("dgvcListType", "Type of list") .Item(index).DataPropertyName = "ListType" Dim btnColumn As New DataGridViewDisableButtonColumn btnColumn.Name = "dgvcBrowse" btnColumn.HeaderText = "" btnColumn.Text = "Get List" btnColumn.UseColumnTextForButtonValue = True .Add(btnColumn) End With End Sub
Y a-t-il autre chose à faire ? Suis-je passé à côté de quelque chose ?
Partager