i have developed a speech processing exe (31aug.xe) which listen to what u speak and write it in a file called OUTPUT.Accordin g to the contents in file called CHECK,picture shud change.Display should change only when there is "b' in DISPLAYfile.oth erwise,old display must remain.Now i want the GUI in VB.net 2 to display the result as soon as the file contents change.Please see the code below
[CODE=vbnet]Shell("31aug.ex e", vbNormalFocus)
'System.Threadi ng.Thread.Sleep (5000)
'this waits till user speaks something.
Dim iofile As New StreamReader("D ISPLAY")
Dim ioline As String
ioline = iofile.ReadLine
iofile.Close()
Dim i As Integer
i = 0
While i >= 0
If i > 0 Then
Me.Update()
End If
If ioline = "b" Then
Dim iofile1 As New StreamReader("O UTPUT")
Dim ioline1 As String
ioline1 = iofile1.ReadLin e
iofile1.Close()
mainTB.Text = ioline1
Dim iofile2 As New StreamReader("C HECK")
Dim ioline2 As String
ioline2 = iofile2.ReadLin e
iofile2.Close()
If ioline2 = "Dusheri" Then
PictureBox1.Ima ge = My.Resources.ma ngo1
Else
If ioline2 = "Orange" Then
PictureBox1.Ima ge = My.Resources.or ange
Else
If ioline2 = "Maize" Then
PictureBox1.Ima ge = My.Resources.ma ize
Else
If ioline2 = "SonaMahsur i" Then
PictureBox1.Ima ge = My.Resources.Ri ce
Else
If ioline2 = "Fine" Then
PictureBox1.Ima ge = My.Resources.su gar
Else
If ioline2 = "Bajra" Then
PictureBox1.Ima ge = My.Resources.ba jra
End If
End If
End If
End If
End If
End If
i = i + 1
'MsgBox("shall we go again?")
End If
End While[/CODE]
I wrote this code in form load event.Now,this is working fine as long as i include this last message box.But if i remove,its showing 100% cpu usage .Please help me how to solve this.
[CODE=vbnet]Shell("31aug.ex e", vbNormalFocus)
'System.Threadi ng.Thread.Sleep (5000)
'this waits till user speaks something.
Dim iofile As New StreamReader("D ISPLAY")
Dim ioline As String
ioline = iofile.ReadLine
iofile.Close()
Dim i As Integer
i = 0
While i >= 0
If i > 0 Then
Me.Update()
End If
If ioline = "b" Then
Dim iofile1 As New StreamReader("O UTPUT")
Dim ioline1 As String
ioline1 = iofile1.ReadLin e
iofile1.Close()
mainTB.Text = ioline1
Dim iofile2 As New StreamReader("C HECK")
Dim ioline2 As String
ioline2 = iofile2.ReadLin e
iofile2.Close()
If ioline2 = "Dusheri" Then
PictureBox1.Ima ge = My.Resources.ma ngo1
Else
If ioline2 = "Orange" Then
PictureBox1.Ima ge = My.Resources.or ange
Else
If ioline2 = "Maize" Then
PictureBox1.Ima ge = My.Resources.ma ize
Else
If ioline2 = "SonaMahsur i" Then
PictureBox1.Ima ge = My.Resources.Ri ce
Else
If ioline2 = "Fine" Then
PictureBox1.Ima ge = My.Resources.su gar
Else
If ioline2 = "Bajra" Then
PictureBox1.Ima ge = My.Resources.ba jra
End If
End If
End If
End If
End If
End If
i = i + 1
'MsgBox("shall we go again?")
End If
End While[/CODE]
I wrote this code in form load event.Now,this is working fine as long as i include this last message box.But if i remove,its showing 100% cpu usage .Please help me how to solve this.
Comment