2014-06-05 2 views
-1

"새 항목이 없을 때 표시 할 앱 만들기를 시도 중입니다. 그래서 Label1과 Timer를 만들었습니다. 나는 모든 secound가 status.txt 텍스트가 0이면 text.txt의 텍스트를 보여주기 위해 아무 것도 보여주지 않기를 원한다. 이것은 지금까지 시도 할 것입니다 :타이머 및 레이블 텍스트 업데이트

Public Class Form1 
    Dim client As WebClient = New WebClient() 
    Dim status As String = client.DownloadString("http://force-play.com/launcher/status.txt") 
    Dim information As String = client.DownloadString("http://force-play.com/launcher/text.txt") 

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
     Timer1.Start() 
     Timer1.Interval = 1000 
    End Sub 

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 
     If status = 0 Then 
      Label1.Text = "No New Info" 
     End If 
     If status = 1 Then 
      Label1.Text = information 
     End If 
    End Sub 
End Class 
+3

그리고? 질문이 표시되지 않습니다 ... – APrough

+0

타이머가 틱 할 때마다 상태를 업데이트해야합니다. 상태가 한 번만 설정되는 것처럼 보입니다. –

+0

- 아마도 문제는 아니지만 타이머를 시작한 후 간격을 설정하는 중입니다. 맞지 않습니다. –

답변

1

시도가 Timer1_Tick 방법의 시작 부분에 status 문자열을 설정.

관련 문제