1

I have a datagridview that are connected to a table in SQL database. There is a column of type VARBINARY(MAX) that store a sequence of bytes. How can I extract these bytes from the grid view?

my code is:

byte [] a = datagridview.CurrentRow.Cells[4].Value;

in which cell[4] contain the bytes.

but it gives an error:

cannot implicitly convert type Object To byte[]

1
  • Cast the Object to byte[]? Commented Jun 29, 2015 at 7:30

1 Answer 1

1

Try casting the right hand side like this

byte [] a = (byte [])datagridview.CurrentRow.Cells[4].Value;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.