Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


VB Console application


VB Console application

Author
Message
SDK
SDK
Forum God
Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)

Group: Forum Members
Posts: 19, Visits: 78
UploadValuesAsync Method does not working for Console Application Any idea ???? Sad

Thank you
zack
zack
Forum God
Forum God (13K reputation)Forum God (13K reputation)Forum God (13K reputation)Forum God (13K reputation)Forum God (13K reputation)Forum God (13K reputation)Forum God (13K reputation)Forum God (13K reputation)Forum God (13K reputation)

Group: Forum Members
Posts: 102, Visits: 110
Are you using .net? Can you post your code?
SDK
SDK
Forum God
Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)Forum God (2.5K reputation)

Group: Forum Members
Posts: 19, Visits: 78
Sample Code



Imports System.Net

Imports System.Xml

Imports System.IO

Imports System.Text

Imports System.Data.OleDb

'Imports ADODB

Imports System.Net.WebProxy

Imports System.Net.HttpWebRequest

Module Module1

Sub Main()

Console.WriteLine("Calling...")

Try

For x As Integer = 0 To 3

import("\temp\xml1.txt")

Next

Catch ex As Exception

Console.WriteLine(ex.Message)

End Try

Console.WriteLine("Completed")

End Sub



Private Sub import(ByVal filename As String)

Try

Dim objReader As New StreamReader(filename)

Dim sLine As String = ""

Dim arrText As New ArrayList()

Do

sLine = objReader.ReadLine()

If Not sLine Is Nothing Then

arrText.Add(sLine)

End If

Loop Until sLine Is Nothing

objReader.Close()

Dim a As String = ""

For Each sLine In arrText

a = a + sLine

Next

Dim creatorApiUrl As String = ""

Dim uri1 As Uri = New Uri(creatorApiUrl)

Dim creator_client As WebClient = New WebClient

Dim myNameValueCollection As New System.Collections.Specialized.NameValueCollection

myNameValueCollection.Add("XMLString", a)

Dim handler As UploadValuesCompletedEventHandler = New UploadValuesCompletedEventHandler(AddressOf Completed)

AddHandler creator_client.UploadValuesCompleted, handler



creator_client.Headers.Add("CharSet", "UTF-8")

creator_client.UploadValuesAsync(uri1, myNameValueCollection)

Catch ex As Exception

Console.WriteLine(ex.Message)

End Try

End Sub

Private Sub Completed(ByVal sender As Object, ByVal e As UploadValuesCompletedEventArgs)

Console.WriteLine("Success")

End Sub

End Module





Above code using in console application. It's working fine in Windows Form Appliaction.

Thank you
Edited
10/15/2012 by SDK
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search