ERROR - Image Field


Author
Message
Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
Checks the business rules on the current row returned error.

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 Smile



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search