private void tbCadastroBO1_BusinessRulesChecked(MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs e){ ClearErrorProvider(); //-- Verify Business Rules if (!tbCadastroBO1.CheckRulesOnRow()) { foreach (BrokenRule loRule in tbCadastroBO1.BrokenRules.ToArray()) { if (loRule.FieldName.EndsWith("Foto", StringComparison.OrdinalIgnoreCase)) SetErrorProvider(picFoto, loRule.Description); } }}
This is OK.private void tbCadastroBO1_BusinessRulesChecked(MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs e){ foreach (BrokenRule loRule in tbCadastroBO1.BrokenRules.ToArray()) { if (loRule.FieldName.EndsWith("Foto", StringComparison.OrdinalIgnoreCase)) SetErrorProvider(picFoto, loRule.Description); }} Rogério Mauri
private void TbCadastroBO_CheckRulesOnCurrentRow(CheckRulesEventArgs e){ if (this.Foto.Width > 110 || this.Foto.Height > 150) this.AddBrokenRule(TbCadastroBOFieldNames.Foto, "Foto com dimensão inválida"); if (this.Foto.HorizontalResolution > 210 || this.Foto.HorizontalResolution < 80 || this.Foto.VerticalResolution > 210 || this.Foto.VerticalResolution < 80) this.AddBrokenRule(TbCadastroBOFieldNames.Foto, "Foto com resolução inválida");}
Returned error in get (try{..}): System.StackOverflowException was unhandled{Cannot evaluate expression because the current thread is in a stack overflow state.}
[Browsable(false), BusinessFieldDisplayInEditor(), Description("Foto"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]public System.Drawing.Bitmap Foto{ get { try { return (System.Drawing.Bitmap)this.BinaryFormatter.Deserialize(new MemoryStream((Byte[])this.CurrentRow["Foto"])); } catch { return null; } } set { MemoryStream loStream = new MemoryStream(); this.BinaryFormatter.Serialize(loStream, value); this.CurrentRow["Foto"] = loStream.ToArray(); }} Rogério Mauri