Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 653017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:20:09+00:00 2026-05-13T22:20:09+00:00

All the automated, online converters weren’t able to convert this code. Unfortunately my brief

  • 0

All the automated, online converters weren’t able to convert this code. Unfortunately my brief knowledge of C# has also let me down. The code originates from a blog, linked from another of my questions.

Here is the code snippet in C#;

        var virtualFileDataObject = new VirtualFileDataObject();
        virtualFileDataObject.SetData(new VirtualFileDataObject.FileDescriptor[]
        {
            new VirtualFileDataObject.FileDescriptor
            {
                Name = "abc.txt",
                StreamContents = stream =>
                    {
                        using(var webClient = new WebClient())
                        {
                            var data = webClient.DownloadData("http://www.google.com");
                            stream.Write(data, 0, data.Length);
                        }
                    }
            },
        });

I currently have in VB.NET (removed some of the in-line stuff);

    Dim virtualFileDataObject = New VirtualFileDataObject()
    Dim vf As New VirtualFileDataObject.FileDescriptor()

    vf.Name = "abc.txt"
    vf.StreamContents = ??

    Using webc As New WebClient()
        Dim data = webc.DownloadData("http://www.google.com")
        stream??.Write(data, 0, data.Length)
    End Using

    virtualFileDataObject.SetData(vf)

Your help would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:20:10+00:00Added an answer on May 13, 2026 at 10:20 pm

    StreamContents is being set with an anonymous method, which VB.NET does not support (but it does in VB.NET 10 which is coming out in .NET 4.0). Next best thing I can suggest is this:

    vf.StreamContents = AddressOf(MyStreamContents)
    
    Public Sub MyStreamContents(ByVal stream As <Whatever the type is>)
    
      Using webc As New WebClient()
            Dim data = webc.DownloadData("http://www.google.com")
            stream.Write(data, 0, data.Length)
        End Using
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have a generator which made some automated code (creating all the get,
All, Apologies in advance - this question might be too open-ended for SO. Anyway...
I am looking for an automated way to iterate over all ObjectQueries and set
I installed jobberBase using automatic installation (softaculous) on arvixe. As this was all automatic
In order to support automated testing tools I need to x:Name all controls (so
All this CUDA lark is head-melting in its power, but something I've been wondering
In our current database development evironment we have automated build procceses check all the
I have a unique set of processes that all need to be automated. We
I'm doing a non-automated git bisect via command line. All is going well until
Hey all, its your typical slider - both automated and controlled by user click.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.