Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Writing files to a server with Visual Basic

Injury

Awesome Bro

I'm trying to write a text file to my server via Visual Basic, and then open it up as well. I have this so far!

Code:
 

Imports System

Imports System.IO

Imports System.Net

Imports System.Text

...

Public Class Form1

    Dim read, writer As String

    Dim objStream As Stream

    Dim sr As IO.StreamReader = IO.File.OpenText("http://www.plaidapple.ithaca-ny.com/text.txt")

    Dim sw As IO.StreamWriter = IO.File.CreateText("http://www.plaidapple.ithaca-ny.com/text.txt")

    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInput.Click

        Dim sURL, read As String

        Dim objStream As Stream

        Dim wrGETURL As WebRequest

        sURL = "http://www.plaidapple.ithaca-ny.com/test.txt"

        wrGETURL = WebRequest.Create(sURL)

        objStream = wrGETURL.GetResponse.GetResponseStream()

        read = sr.ReadLine

        lstOutput.Items.Add(read)

        objStream.Close()

    End Sub

End Class

 

The code is fine, it just says there is an InternalException error when I try to run it. I'd really like some help on this, I'm pretty stumped myself...and MSDN isn't helping very much either!

Thanks!
 
I'm confused- How are you uploading the file back to the server? I'm pretty sure you'd have to do something with FTP, which would need some sort of authentication. I'm not too familiar with VB.Net, so disregard this if I missed something.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top