Please Help Me (convert VB.net code to VB6)

samwarez

Registered Member
Joined
Sep 17, 2015
Messages
88
Reaction score
32
Please Help Me (convert VB.net code to VB6)
this code


-------------------------------------------------------------------
Imports System.IO
Imports System.Text
Imports System.Net

Public Sub Upload()
Dim imageData() As Byte
Dim fileStream As FileStream = File.OpenRead(Application.StartupPath & "\1.png")
imageData = New Byte((fileStream.Length) - 1) {}
fileStream.Read(imageData, 0, imageData.Length)
fileStream.Close()
Dim uploadRequestString As String = HttpUtility.UrlEncode("image", Encoding.UTF8) + "=" + HttpUtility.UrlEncode(System.Convert.ToBase64String(imageData))
Dim webRequest As HttpWebRequest = CType(Net.WebRequest.Create("http://api.imgur.com/3/upload"), HttpWebRequest)
webRequest.Method = "POST"
webRequest.ContentType = "application/x-www-form-urlencoded"

webRequest.Headers.Add("Authorization: Client-ID XXX")

webRequest.ServicePoint.Expect100Continue = False
Dim streamWriter As IO.StreamWriter = New IO.StreamWriter(webRequest.GetRequestStream)
streamWriter.Write(uploadRequestString)
streamWriter.Close()
Dim response As WebResponse = webRequest.GetResponse
Dim responseStream As Stream = response.GetResponseStream
Dim responseReader As StreamReader = New StreamReader(responseStream)
Dim responseString As String = responseReader.ReadToEnd
Dim ImageURL As String = Split(responseString, "<original>")(1).Split("<")(0)
Dim X As String
X = ImageURL
Clipboard.SetText(X)
System.Diagnostics.Process.Start(X)
End Sub



---

thanks in advance
 
I don't think it is possible because VB.NET is based on a completely different platform (.NET) that contains so many functions VB6 doesn't have, that no converter will actually correctly convert the .NET code into VB6. You can try converting it by yourself, but you will run into problems just because the VB.NET program most likely contains pieces of code that didn't even exist in VB6 (like Mail, Threading or other classes included in the .NET Framework), so you will have to manually handle that.
 
I don't think it is possible because VB.NET is based on a completely different platform (.NET) that contains so many functions VB6 doesn't have, that no converter will actually correctly convert the .NET code into VB6. You can try converting it by yourself, but you will run into problems just because the VB.NET program most likely contains pieces of code that didn't even exist in VB6 (like Mail, Threading or other classes included in the .NET Framework), so you will have to manually handle that.
Thought as much as each time I came across a similar situation I didnt bother to try. I reckon what you said is a confirmation.
 
Back
Top