VB, DataGrid, .Net Compact Framework
Louvins
-
louvins -
louvins -
Salut à tous!
Je developpe sur une application Mobile qui tourne sur WM6.
ce qui implique .NET Compact Framework.
Il y a donc un certain nombre de fonctionnalites en moins,
dont les DataGridView qui sont tres simples a manipuler.
Je suis oblige d'utiliser une DataGrid.
Mais je ne parviens pas à insérer de TextBox dans ma DataGrid.
L'objectif étant d'obtenir un tableau contenant deux colonnes :
- une premiere avec le noms des variables. (Non modifiable)
- une deuxième avec la valeur des variables, des TextBoxs préremplies.
J'ai essayé d'utiliser une DataGridTextBoxColumn mais en vain. :(
La colonne de TextBoxs ne s'affiche pas.
Voici mon code:
' Create two DataTables.
Dim tFields As New DataTable("Fields")
Dim tOrders As New DataTable("Orders")
' Create a columns, and add it to the first table.
Dim tFieldsName As New DataColumn("Name", GetType(String))
Dim tFieldsValue As New DataGridTextBoxColumn()
tFieldsValue.HeaderText = "Value"
' Get the CurrencyManager for the DataTable.
Dim cm As CurrencyManager = CType(Me.BindingContext(tFields), CurrencyManager)
' Use the CurrencyManager to get the PropertyDescriptor for the new column.
Dim pd As PropertyDescriptor = cm.GetItemProperties()("Name")
Dim myColumnTextColumn As DataGridTextBoxColumn
' Create the DataGridTextBoxColumn with the PropertyDescriptor.
myColumnTextColumn = New DataGridTextBoxColumn()
myColumnTextColumn.PropertyDescriptor = pd
'Add the colomn "Name" to the data table
tFields.Columns.Add(tFieldsName)
...
Dim tableStyle As New DataGridTableStyle()
tableStyle.GridColumnStyles.Add(tFieldsValue)
DataGrid.TableStyles.Add(tableStyle)
DataGrid.DataSource = tFields
La DataGrid est initialisee sur la page design du formulaire.
Merci de votre aide.
Je developpe sur une application Mobile qui tourne sur WM6.
ce qui implique .NET Compact Framework.
Il y a donc un certain nombre de fonctionnalites en moins,
dont les DataGridView qui sont tres simples a manipuler.
Je suis oblige d'utiliser une DataGrid.
Mais je ne parviens pas à insérer de TextBox dans ma DataGrid.
L'objectif étant d'obtenir un tableau contenant deux colonnes :
- une premiere avec le noms des variables. (Non modifiable)
- une deuxième avec la valeur des variables, des TextBoxs préremplies.
J'ai essayé d'utiliser une DataGridTextBoxColumn mais en vain. :(
La colonne de TextBoxs ne s'affiche pas.
Voici mon code:
' Create two DataTables.
Dim tFields As New DataTable("Fields")
Dim tOrders As New DataTable("Orders")
' Create a columns, and add it to the first table.
Dim tFieldsName As New DataColumn("Name", GetType(String))
Dim tFieldsValue As New DataGridTextBoxColumn()
tFieldsValue.HeaderText = "Value"
' Get the CurrencyManager for the DataTable.
Dim cm As CurrencyManager = CType(Me.BindingContext(tFields), CurrencyManager)
' Use the CurrencyManager to get the PropertyDescriptor for the new column.
Dim pd As PropertyDescriptor = cm.GetItemProperties()("Name")
Dim myColumnTextColumn As DataGridTextBoxColumn
' Create the DataGridTextBoxColumn with the PropertyDescriptor.
myColumnTextColumn = New DataGridTextBoxColumn()
myColumnTextColumn.PropertyDescriptor = pd
'Add the colomn "Name" to the data table
tFields.Columns.Add(tFieldsName)
...
Dim tableStyle As New DataGridTableStyle()
tableStyle.GridColumnStyles.Add(tFieldsValue)
DataGrid.TableStyles.Add(tableStyle)
DataGrid.DataSource = tFields
La DataGrid est initialisee sur la page design du formulaire.
Merci de votre aide.
A voir également:
- VB, DataGrid, .Net Compact Framework
- Net framework 2.0 - Télécharger - Divers Utilitaires
- Net framework 4.0 - Télécharger - Divers Utilitaires
- Paint net - Télécharger - Dessin & Illustration
- Logo .net - Télécharger - Études & Formations
- Vb - Télécharger - Langages