I am programming a barcode scanner running Windows Mobile 5. The operation of the program is simple enough - I capture a barcode, obtain data from an underlying SQLCE3.5 database and display the results in a datagrid on a form.
What I cannot do and cannot find any articles on is how to alter the column widths in the datagrid. I've read articles regarding using the DataGridView component, but that doesn't seem to be "allowed" in Windows Mobile development. I only want to display two resulting columns appropriately sized, but I find that I can't even control the width of that.
Can anyone tell me how to programmatically alter the column widths? I've tried using the DataGridTableStyles as well, but end up getting errors of "value does not fall within the expected range".
I've attached a code snippet to see if that helps. I've been staring at this for so long that I might just have done something completely stupid...
Thanks in advance for your assistance.
'conn and all other variables have been declared
sSQL = "SELECT plantdesc FROM plantscanstore"
cmd = New System.Data.SqlServerCe.SqlCeCommand(sSQL, conn)
dt = New DataTable
da = New SqlServerCe.SqlCeDataAdapter
da.SelectCommand = cmd
da.SelectCommand.Connection = conn
Me.DataGrid1.DataSource = dt
Dim aGridTableStyle As New DataGridTableStyle
aGridTableStyle.MappingName = "plantscanstore"
Dim aCol1 As New DataGridTextBoxColumn
.MappingName = "plantdesc"
.Width = 240
.HeaderText = "Description"