Click here to Skip to main content
15,890,947 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: esc key Pin
Luc Pattyn1-Apr-11 3:17
sitebuilderLuc Pattyn1-Apr-11 3:17 
GeneralRe: esc key Pin
Herboren7-Apr-11 4:58
Herboren7-Apr-11 4:58 
AnswerRe: esc key Pin
Luc Pattyn7-Apr-11 5:01
sitebuilderLuc Pattyn7-Apr-11 5:01 
GeneralRe: esc key Pin
Herboren7-Apr-11 5:11
Herboren7-Apr-11 5:11 
GeneralRe: esc key Pin
Luc Pattyn7-Apr-11 5:20
sitebuilderLuc Pattyn7-Apr-11 5:20 
QuestionAccessing Printer Settings Not Built Into .NET Pin
Dominick Marciano31-Mar-11 5:42
professionalDominick Marciano31-Mar-11 5:42 
AnswerRe: Accessing Printer Settings Not Built Into .NET Pin
Johan Hakkesteegt13-Apr-11 23:01
Johan Hakkesteegt13-Apr-11 23:01 
QuestionWebrequest & GUI Refresh (Threading?) Pin
cipherwar28-Mar-11 22:37
cipherwar28-Mar-11 22:37 
Hallo,

I've got an problem with my GUI. My program has to request a couple of websites (POST) and then store the responses in local files.
While requesting the sites, a GUI textbox (tbLog) should inform the user, what site actually is being requested and a "STOP" butten should enable the user to stop the whole process.

Now, when I start work, the GUI freezes and the user cannot do anything until all websites are done. There is no update of tbLog.text at all and no stop button can be pressed.

Me.Refresh() does not help, to.

I read something about threading, but all examples seem to be oversized for my problem.

This is part of my code (simplyfied):

1)Start working by clicking button:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Me.tbLog.Clear()
    Dim zaehler As Integer
    Do Until (zaehler = 20)
        Dim antwortseite As String
        antwortseite = getResults("http://localhost/antiquartwo/test-params.php", "field-keywords=ASP.NET 2.0")
        ' todo: verarbeiten der antwortseite
        ' anzeige der response in der GUI
        Me.tbLog.Text &= antwortseite
        zaehler = zaehler + 1
    Loop
    Me.Refresh()
End Sub


2) Webrequest (POST):

Function getResults(ByVal portalURI As String, ByVal suchbegriff As String) As String

       Dim uri As New Uri(portalURI)
       'Dim data As String = "field-keywords=ASP.NET 2.0"
       Dim data As String = suchbegriff
       Dim request As HttpWebRequest = HttpWebRequest.Create(uri)
       request.Method = WebRequestMethods.Http.Post
       request.ContentLength = data.Length
       request.ContentType = "application/x-www-form-urlencoded"
       Dim writer As New StreamWriter(request.GetRequestStream)
       writer.Write(data)
       writer.Close()
       Dim oResponse As HttpWebResponse = request.GetResponse()
       Dim reader As New StreamReader(oResponse.GetResponseStream())
       Dim tmp As String = reader.ReadToEnd()
       oResponse.Close()
       'Response.Write(tmp)
       getResults = tmp
   End Function



Can anybody help me by optimizing my code?

Thank you. Cipherwar
AnswerRe: Webrequest & GUI Refresh (Threading!) Pin
Luc Pattyn28-Mar-11 23:53
sitebuilderLuc Pattyn28-Mar-11 23:53 
GeneralRe: Webrequest & GUI Refresh (Threading!) Pin
cipherwar29-Mar-11 1:58
cipherwar29-Mar-11 1:58 
GeneralRe: Webrequest & GUI Refresh (Threading!) Pin
Luc Pattyn29-Mar-11 2:08
sitebuilderLuc Pattyn29-Mar-11 2:08 
GeneralRe: Webrequest & GUI Refresh (Threading!) Pin
cipherwar30-Mar-11 19:18
cipherwar30-Mar-11 19:18 
GeneralRe: Webrequest & GUI Refresh (Threading!) Pin
Luc Pattyn30-Mar-11 22:08
sitebuilderLuc Pattyn30-Mar-11 22:08 
QuestionHow to Get Login and Log off information in Windows [modified] Pin
εїзεїзεїз27-Mar-11 22:23
εїзεїзεїз27-Mar-11 22:23 
AnswerRe: How to Get Login and Log off information in Windows Pin
Eddy Vluggen27-Mar-11 22:36
professionalEddy Vluggen27-Mar-11 22:36 
GeneralRe: How to Get Login and Log off information in Windows Pin
εїзεїзεїз27-Mar-11 22:44
εїзεїзεїз27-Mar-11 22:44 
GeneralRe: How to Get Login and Log off information in Windows Pin
Richard MacCutchan27-Mar-11 23:14
mveRichard MacCutchan27-Mar-11 23:14 
GeneralRe: How to Get Login and Log off information in Windows Pin
εїзεїзεїз27-Mar-11 23:32
εїзεїзεїз27-Mar-11 23:32 
GeneralRe: How to Get Login and Log off information in Windows Pin
Eddy Vluggen28-Mar-11 0:47
professionalEddy Vluggen28-Mar-11 0:47 
GeneralRe: How to Get Login and Log off information in Windows Pin
εїзεїзεїз28-Mar-11 3:37
εїзεїзεїз28-Mar-11 3:37 
QuestionRe: How to Get Login and Log off information in Windows Pin
Eddy Vluggen28-Mar-11 4:05
professionalEddy Vluggen28-Mar-11 4:05 
GeneralRe: How to Get Login and Log off information in Windows Pin
imen53228-Mar-11 20:55
imen53228-Mar-11 20:55 
GeneralRe: How to Get Login and Log off information in Windows Pin
Eddy Vluggen29-Mar-11 0:34
professionalEddy Vluggen29-Mar-11 0:34 
AnswerRe: How to Get Login and Log off information in Windows Pin
Luc Pattyn28-Mar-11 3:16
sitebuilderLuc Pattyn28-Mar-11 3:16 
GeneralRe: How to Get Login and Log off information in Windows Pin
εїзεїзεїз28-Mar-11 3:29
εїзεїзεїз28-Mar-11 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.