VB.net Error trying to paint

Hi

I get the errors further down with the following code

Code
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms  

Public Class frmGradientFiller
   Sub oColor()
        'https://msdn.microsoft.com/en-us/library/ms754083(v=vs.110).aspx

        Dim diagonalFillRectangle As New Rectangle()
        diagonalFillRectangle.Width = 200
        diagonalFillRectangle.Height = 100

        ' Create a diagonal linear gradient with four stops.   
        Dim myLinearGradientBrush As New LinearGradientBrush()
        myLinearGradientBrush.StartPoint = New Point(0, 0)
        myLinearGradientBrush.EndPoint = New Point(1, 1)
        myLinearGradientBrush.GradientStops.Add(New GradientStop(Colors.Yellow, 0.0))
        myLinearGradientBrush.GradientStops.Add(New GradientStop(Colors.Red, 0.25))
        myLinearGradientBrush.GradientStops.Add(New GradientStop(Colors.Blue, 0.75))
        myLinearGradientBrush.GradientStops.Add(New GradientStop(Colors.LimeGreen, 1.0))

        ' Use the brush to paint the rectangle.
        diagonalFillRectangle.Fill = myLinearGradientBrush
    End Sub

Open in new window


Error
Error	44	Overload resolution failed because no accessible 'New' accepts this number of arguments.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	20	13	Automator
Error	45	'StartPoint' is not a member of 'System.Drawing.Drawing2D.LinearGradientBrush'.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	21	9	Automator
Error	46	'EndPoint' is not a member of 'System.Drawing.Drawing2D.LinearGradientBrush'.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	22	9	Automator
Error	47	'GradientStops' is not a member of 'System.Drawing.Drawing2D.LinearGradientBrush'.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	23	9	Automator
Error	48	Type 'GradientStop' is not defined.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	23	53	Automator
Error	49	'GradientStops' is not a member of 'System.Drawing.Drawing2D.LinearGradientBrush'.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	24	9	Automator
Error	50	Type 'GradientStop' is not defined.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	24	53	Automator
Error	51	'GradientStops' is not a member of 'System.Drawing.Drawing2D.LinearGradientBrush'.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	25	9	Automator
Error	52	Type 'GradientStop' is not defined.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	25	53	Automator
Error	53	'GradientStops' is not a member of 'System.Drawing.Drawing2D.LinearGradientBrush'.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	26	9	Automator
Error	54	Type 'GradientStop' is not defined.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	26	53	Automator
Error	55	'Fill' is not a member of 'System.Drawing.Rectangle'.	C:\Users\Murray\Documents\Visual Studio 2010\Projects\Automator\Automator\frmGradientFiller.vb	29	9	Automator

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
Can you show us your imports statements?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Imports System.Drawing
 Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
CodeCruiserCommented:
You are confusing LinearGradientBrush class in System.Windows.Media (WPF) with the same class in Drawing2D.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.