Quick Question

  • 15 years ago

    Hello everyone, this is probably going to be a simple question.


    Since i just started using Visual Basic 2005, ive been searching everywhere to do just a little simple script. What i want to be able to do is just have a button to retrieve a text file, or HTML file from my webserver and display it in either a text box or label.


    Of anyone could help me with this little script that would be great!


    Thanks all,
    Jon

  • 15 years ago

    Hi Jon,


    Im really sorry but I dont use VB2005 so I dont know if the syntax is radically different from the scripting I've done in the past.


    I always used something like:


    Dim fso, file1
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set file1 = fso.GetFile("c:\MyPathname.txt")
    txtFile.Text = file1.ReadAll


    I found an example that you can download here, again, it is in VB6 but it may be adaptable:
    http://www.vbwm.com/art_1999/whatsnew/filesys.asp


    Sorry I dont know VB2005,


    Regards,


    Bob

  • 15 years ago
    Hmm, i used what you put but nothing shows up in the text box when i run it. There is no errors though! haha.

    Im going to check out that site you posted and see if i can get anything from here.

    Thank you bob,

    Jon
  • 15 years ago

    I'm afraid the syntax for VB2005 is radically different to VB6.


    VB2005 is a .NET language, so uses the Common Language Runtime and Common Type System, compiled to Intermediate Language and JIT compiled at runtime. VB6 compiles to native code and uses it's own virtual machine.


    To fetch the data from a website, you'll need to look at the .NET documentation, specifically at the HTTP classes in the System.Net namespace.


    VB.NET isn't my thing (nor will it likely ever be!) but as it's essentially the same as C#, this namespace is where you need to start.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Computer Science is no more about computers than astronomy is about telescopes.” - E. W. Dijkstra