Private Sub fillFormData(res As DBResult)
For Each n As Node In pnlItems.GetAllViewsRecursive
Private idx As Int = 0
If n.Tag = "" Then Continue
For Each col In res.Columns.Keys
If n.Tag = col Then
If n Is TextField Then
Private t As TextField = n
Private row() As Object = res.Rows.Get(0)
t.Text = utils.ifNull(row(idx),"")
End If
If n Is Label Then
Private l As Label = n
Private row() As Object = res.Rows.Get(0)
l.Text = utils.ifNull(row(idx),"")
End If
If n Is DatePicker Then
Private d As DatePicker = n
Private row() As Object = res.Rows.Get(0)
If utils.ifNull(row(idx),"") <> "" Then
d.DateTicks = row(idx)
Else
d.DateTicks = 0
End If
End If
If n Is ComboBox Then
Private c As ComboBox = n
Private row() As Object = res.Rows.Get(0)
c.SelectedIndex = utils.ifNull(row(idx),0)
c.Value = c.Items.Get(c.SelectedIndex)
End If
If n.Tag = "low_stock_alert_active" Then
swAlertStock.CheckState = utils.switchVal(swAlertStock, utils.ifNull(row(idx),"0"))
End If
If n.Tag = "next_order_alert_active" Then
swNextOrder.CheckState = utils.switchVal(swNextOrder, utils.ifNull(row(idx),"0"))
End If
If n.Tag = "discount_active" Then
swDiscountActive.CheckState = utils.switchVal(swDiscountActive, utils.ifNull(row(idx),"0"))
End If
End If
idx = idx + 1
Next
Next
txtCode.RequestFocus
End Sub