Ok, next question. How do I make the first three columns in my DataGrid invisible? I know this has come up in another recent thread (indeed I stole some code from it!), but it didn't make much sense to me, nor did it work!It just runs as if the Hide ID columns code didn't exist.Code:Private Sub Fill_Orders_Grid() Dim oDataAdapter As MySqlDataAdapter oDataAdapter = New MySqlDataAdapter("SELECT orders.order_id, orders.product_id, orders.user_id, products.title AS Product, users.name AS User, orders.order_date AS 'Date', CONCAT(orders.eta, ' days') AS 'Requested Delivery Schedule', orders.payment_method AS 'Payment Method', orders.status AS 'Order Status' FROM orders LEFT OUTER JOIN products ON orders.product_id=products.product_id LEFT OUTER JOIN users ON orders.user_id=users.user_id ORDER BY orders.order_date DESC;", oConn) If oDataSet.Tables.Contains("orders") Then oDataSet.Tables("orders").Clear() oDataAdapter.Fill(oDataSet, "orders") ' START: Hide ID columns Dim dgsTableStyle = New DataGridTableStyle() Dim dgtTextBoxColumn1 = New DataGridTextBoxColumn() Dim dgtTextBoxColumn2 = New DataGridTextBoxColumn() Dim dgtTextBoxColumn3 = New DataGridTextBoxColumn() dgsTableStyle.DataGrid = grdOrders dgsTableStyle.GridColumnStyles.AddRange(New DataGridColumnStyle() {dgtTextBoxColumn1, dgtTextBoxColumn1, dgtTextBoxColumn1}) dgsTableStyle.ReadOnly = True dgtTextBoxColumn1.format = "" dgtTextBoxColumn1.FormatInfo = Nothing dgtTextBoxColumn1.MappingName = "order_id" dgtTextBoxColumn1.Width = 0 dgtTextBoxColumn2.format = "" dgtTextBoxColumn2.FormatInfo = Nothing dgtTextBoxColumn2.MappingName = "order_id" dgtTextBoxColumn2.Width = 0 dgtTextBoxColumn3.format = "" dgtTextBoxColumn3.FormatInfo = Nothing dgtTextBoxColumn3.MappingName = "order_id" dgtTextBoxColumn3.Width = 0 grdOrders.TableStyles.Add(dgsTableStyle) ' END: Hide ID columns grdOrders.DataSource = oDataSet.Tables("orders") End Sub




Reply With Quote