datagrid with problem

S

Steiner Hubert

hello,
i develop with basic.net a pocket pc application

my table name is "mittel"
the fields in the table are name,id,customer,...

my code:
toGrid.DataSource = dset.Tables("Mittel")
toGrid.TableStyles.Clear()
Dim ts1 As New DataGridTableStyle
ts1.MappingName = "mittel"
Dim myDataCol As New DataGridTextBoxColumn
myDataCol.HeaderText = "id"
myDataCol.MappingName = "id"
ts1.GridColumnStyles.Add(myDataCol)
toGrid.TableStyles.Add(ts1)


-> but _all_ columns are visible!?


now i set a button at the formular
the code of the button:
Dim myGridStyle As DataGridTableStyle
Dim myColumnStyle As DataGridColumnStyle

For Each myGridStyle In Me.Grid_Mittel_Page2.TableStyles
MsgBox(myGridStyle.MappingName, MsgBoxStyle.Information, "1")
For Each myColumnStyle In myGridStyle.GridColumnStyles
MsgBox(myColumnStyle.MappingName, MsgBoxStyle.Information, "2")
Next
Next
End Sub

-> the msgbox shows "mittel", "1"
and "id" , "2"

the msgbox shows the right data
but the datagrid show _alle_ columns

where is the error??
 
I

Ilya Tumanov [MS]

I suspect its "Mittel" vs. "mittel". Make sure you use exact case for
mappings.

Consider using DataTable.TableName and DataColumn.ColumnName instead of hard
coded strings.

You'll be glad you did if one day you'd need to change these names.



Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top