0

i have the following code in vb.net to convert a single pixel to any other color. The chosen parameter inside of setpixel are for test purposes.

InvoiceImage.SetPixel(0 , 0, color.FromArgb(30, 30, 30))

But i get the following error: Exception has been thrown by the target of an invocation. Why is that?

schmanh
  • 29
  • 2
  • 1
    1) Make sure you have enabled [`Option Strict On`](https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/option-strict-statement) for this project. (And make it the default for new VB projects.) – Andrew Morton Dec 31 '22 at 11:05
  • 1
    2) Does anything in ["Exception has been thrown by the target of an invocation" error (mscorlib)](https://stackoverflow.com/q/648113/1115360) help? – Andrew Morton Dec 31 '22 at 11:06

1 Answers1

0

cloning the bitmap one more time and executing SetPixel on this copy worked ;)

Fedor
  • 17,146
  • 13
  • 40
  • 131
schmanh
  • 29
  • 2