I am working with Visual Basic Studio 2013 and one of my forms requires the use of a web client component. I added Web Client to my toolbox and easily added it to my form. When VBStudio cooperates the form does everything as it should perfectly. However, when I loaded it for the first time and tried to debug it told me that adding the component to my form added some lines of code that have been deprecated. This popped up the form#.Designer.vb with the code and I could see the two lines that were causing the problem. I deleted them and saved the vb file and had no problems.

Here are the two deprecated lines:

        Me.WebClient.AllowReadStreamBuffering = False
        Me.WebClient.AllowWriteStreamBuffering = False

And here is the error that is thrown:

Error   4   'Public Property AllowReadStreamBuffering As Boolean' is obsolete: 'This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.'.   C:\Users\Me\Documents\Visual Studio 2013\Projects\WindowsApplication5\WindowsApplication5\Form7.Designer.vb 150 9   WindowsApplication5

Now, every once in a while VBStudio puts those two lines back in and throws the errors when debugging. I am not sure if this would cause crashes or would happen if I deleted the lines and then built my program for release. But either way I am curious as to how I could go about permanently ridding my application of those two lines and not having them re-inserted.

Any ideas will be greatly appreciated!

Hi

The MSDN documentation states that this will not compile in .NET versions 4.5.2 or greater. So, if you need to use this and have no requirement to use .NET 4.5.2 or greater then simply change your target framework to a lower version. This may not be the most suitable resolution depending on your future requirements.

A quick google search also led me to some solutions such as removing the WebClient component from your form and then adding it again. Alternatively, ensure you are using the correct version of System.Net and simply declare your web client in code rather than using the component.

HTH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.