0

I am not suceeding in translating into vb.net some code which works in c#.

The code is from StackOverflow article: How to use a gradient fill (GradientFill) with ClosedXML

I can get most of it correctly except this:

 GradientFill gradientFill = new GradientFill() { Degree = 354 };
    gradientFill.Append(new GradientStop() { Position = 0D, Color = new Color() { Rgb = "FF00FF00" } });
    gradientFill.Append(new GradientStop() { Position = 0.49D, Color = new Color() { Rgb = "FF00FF00" } });
    gradientFill.Append(new GradientStop() { Position = 0.51D, Color = new Color() { Rgb = "FFFFFFFF" } });
    gradientFill.Append(new GradientStop() { Position = 1D, Color = new Color() { Rgb = "FFFFFFFF" } });

Any help would be super apreciated!

1 Answers1

1

You need a With and a . to do that in VB.NET, e.g.

Dim myGradientFill As New GradientFill() With {.Degree = 354}
myGradientFill.Append(New GradientStop() With {.Position = 0D, .Color = New Color() With {.Rgb = "FF00FF00"}})
Christoph
  • 3,322
  • 2
  • 19
  • 28