| | |
dim x as timer
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2008
Posts: 1
Reputation:
Solved Threads: 0
Hi guys
Just a simple question from a newbee..
In VB.net I can use "dim t as new timer" in a windows application, but not in a wpfbrowser application.
It says that "Typ timer is not defined"
anything else in the program seem to funktion. Please if anyone have a suggestion !!!
CODE:
Class Page1
Dim klicka As Integer
Dim send As String
Public Declare Sub Out Lib "DllPort.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
Public Declare Function Inp Lib "DllPort.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Dim PortData ' variable for data at port
Dim t1 As New Timer
Dim t2 As New Timer
Dim t3 As New Timer
Dim TargetFile As System.IO.StreamWriter
Const AddressLPT1 = &H378 'Constant for position of Printer Port 1(LPT1) and Data Port
Const Statusport1 = AddressLPT1 + 1 ' Constant for position of Status Port(LPT1))
Const Controlport1 = AddressLPT1 + 2 ' Constant for position of Control Port (LPT1))
Public Sub trycka()
If Not TextBox10.Text = "CONNECTED TO SAFE" Or Not TextBox10.Text = "CONNECTION TO SAFE IS CLOSED" And TextBox10.Text = "xxx" Then
ElseIf TextBox1.Text = "" Then
TextBox1.Text = klicka
ElseIf TextBox2.Text = "" Then
TextBox2.Text = klicka
ElseIf TextBox3.Text = "" Then
TextBox3.Text = klicka
ElseIf TextBox4.Text = "" Then
TextBox4.Text = klicka
ElseIf TextBox5.Text = "" Then
TextBox5.Text = klicka
ElseIf TextBox6.Text = "" Then
TextBox6.Text = klicka
ElseIf TextBox7.Text = "" Then
TextBox7.Text = klicka
ElseIf TextBox8.Text = "" Then
TextBox8.Text = klicka
End If
End Sub
Private Sub ButtonA_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonA.Click
klicka = "10"
trycka1()
End Sub
Private Sub trycka1()
If TextBox10.Text = "xxx" Or TextBox10.Text = "CONNECTION TO SAFE IS CLOSED" And klicka = "10" Then
t1.Interval = 20
AddHandler t1.Tick, AddressOf Me.t_ShowProgress1
t1.Start()
End If
End Sub
Private Sub t_ShowProgress1()
ProgressBar1.Value += 1
TextBox10.Text = ("xxx")
If ProgressBar1.Value = 100 Then
TextBox10.Text = ("xxx")
t1.Stop()
ProgressBar1.Value = 0
MessageBox.Show("xxx")
End If
End Sub
Private Sub Buttonopen_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Buttonopen.Click
klicka = "12"
trycka2()
End Sub
Private Sub trycka2()
If klicka = "12" And Not TextBox1.Text = "" And Not TextBox2.Text = "" And Not TextBox3.Text = "" And Not TextBox4.Text = "" Then
t2.Interval = 200
AddHandler t2.Tick, AddressOf Me.t_ShowProgress2
'AddHandler t2.Tick, AddressOf Me.t_ShowTime
t2.Start()
End If
End Sub
Private Sub t_ShowProgress2()
ProgressBar1.Value += 1
If ProgressBar1.Value = 100 Then
ProgressBar1.Value = 0
t2.Stop()
TextBox11.Text = ("xxx")
TextBox10.Text = ("xxx")
End If
End Sub
Private Sub Buttonchange_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Buttonchange.Click
klicka = "11"
trycka3()
End Sub
Private Sub trycka3()
If TextBox10.Text = "xxx" Then
If klicka = "11" And Not TextBox1.Text = "" And Not TextBox2.Text = "" And Not TextBox3.Text = "" And Not TextBox4.Text = "" Then
t3.Interval = 100
AddHandler t3.Tick, AddressOf Me.t_ShowProgress3
'AddHandler t3.Tick, AddressOf Me.t_ShowTime
t3.Start()
End If
Else
MessageBox.Show("xxx")
End If
End Sub
Private Sub t_ShowProgress3()
TextBox11.Text = ("xxx")
ProgressBar1.Value += 1
End If
If ProgressBar1.Value = 100 Then
MessageBox.Show("xxx")
TextBox10.Text = ("xxx")
t3.Stop()
ProgressBar1.Value = "0"
End If
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
klicka = "1"
trycka()
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
klicka = "2"
trycka()
End Sub
Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
klicka = "3"
trycka()
End Sub
Private Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
klicka = "4"
trycka()
End Sub
Private Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
klicka = "5"
trycka()
End Sub
Private Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click
klicka = "6"
trycka()
End Sub
Private Sub Button7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button7.Click
klicka = "7"
trycka()
End Sub
Private Sub Button8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button8.Click
klicka = "8"
trycka()
End Sub
Private Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button9.Click
klicka = "9"
trycka()
End Sub
Private Sub Button0_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button0.Click
klicka = "0"
trycka()
End Sub
End Class
Just a simple question from a newbee..
In VB.net I can use "dim t as new timer" in a windows application, but not in a wpfbrowser application.
It says that "Typ timer is not defined"
anything else in the program seem to funktion. Please if anyone have a suggestion !!!
CODE:
Class Page1
Dim klicka As Integer
Dim send As String
Public Declare Sub Out Lib "DllPort.dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)
Public Declare Function Inp Lib "DllPort.dll" Alias "Inp32" (ByVal PortAddress As Integer) As Integer
Dim PortData ' variable for data at port
Dim t1 As New Timer
Dim t2 As New Timer
Dim t3 As New Timer
Dim TargetFile As System.IO.StreamWriter
Const AddressLPT1 = &H378 'Constant for position of Printer Port 1(LPT1) and Data Port
Const Statusport1 = AddressLPT1 + 1 ' Constant for position of Status Port(LPT1))
Const Controlport1 = AddressLPT1 + 2 ' Constant for position of Control Port (LPT1))
Public Sub trycka()
If Not TextBox10.Text = "CONNECTED TO SAFE" Or Not TextBox10.Text = "CONNECTION TO SAFE IS CLOSED" And TextBox10.Text = "xxx" Then
ElseIf TextBox1.Text = "" Then
TextBox1.Text = klicka
ElseIf TextBox2.Text = "" Then
TextBox2.Text = klicka
ElseIf TextBox3.Text = "" Then
TextBox3.Text = klicka
ElseIf TextBox4.Text = "" Then
TextBox4.Text = klicka
ElseIf TextBox5.Text = "" Then
TextBox5.Text = klicka
ElseIf TextBox6.Text = "" Then
TextBox6.Text = klicka
ElseIf TextBox7.Text = "" Then
TextBox7.Text = klicka
ElseIf TextBox8.Text = "" Then
TextBox8.Text = klicka
End If
End Sub
Private Sub ButtonA_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonA.Click
klicka = "10"
trycka1()
End Sub
Private Sub trycka1()
If TextBox10.Text = "xxx" Or TextBox10.Text = "CONNECTION TO SAFE IS CLOSED" And klicka = "10" Then
t1.Interval = 20
AddHandler t1.Tick, AddressOf Me.t_ShowProgress1
t1.Start()
End If
End Sub
Private Sub t_ShowProgress1()
ProgressBar1.Value += 1
TextBox10.Text = ("xxx")
If ProgressBar1.Value = 100 Then
TextBox10.Text = ("xxx")
t1.Stop()
ProgressBar1.Value = 0
MessageBox.Show("xxx")
End If
End Sub
Private Sub Buttonopen_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Buttonopen.Click
klicka = "12"
trycka2()
End Sub
Private Sub trycka2()
If klicka = "12" And Not TextBox1.Text = "" And Not TextBox2.Text = "" And Not TextBox3.Text = "" And Not TextBox4.Text = "" Then
t2.Interval = 200
AddHandler t2.Tick, AddressOf Me.t_ShowProgress2
'AddHandler t2.Tick, AddressOf Me.t_ShowTime
t2.Start()
End If
End Sub
Private Sub t_ShowProgress2()
ProgressBar1.Value += 1
If ProgressBar1.Value = 100 Then
ProgressBar1.Value = 0
t2.Stop()
TextBox11.Text = ("xxx")
TextBox10.Text = ("xxx")
End If
End Sub
Private Sub Buttonchange_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Buttonchange.Click
klicka = "11"
trycka3()
End Sub
Private Sub trycka3()
If TextBox10.Text = "xxx" Then
If klicka = "11" And Not TextBox1.Text = "" And Not TextBox2.Text = "" And Not TextBox3.Text = "" And Not TextBox4.Text = "" Then
t3.Interval = 100
AddHandler t3.Tick, AddressOf Me.t_ShowProgress3
'AddHandler t3.Tick, AddressOf Me.t_ShowTime
t3.Start()
End If
Else
MessageBox.Show("xxx")
End If
End Sub
Private Sub t_ShowProgress3()
TextBox11.Text = ("xxx")
ProgressBar1.Value += 1
End If
If ProgressBar1.Value = 100 Then
MessageBox.Show("xxx")
TextBox10.Text = ("xxx")
t3.Stop()
ProgressBar1.Value = "0"
End If
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
klicka = "1"
trycka()
End Sub
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
klicka = "2"
trycka()
End Sub
Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
klicka = "3"
trycka()
End Sub
Private Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
klicka = "4"
trycka()
End Sub
Private Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
klicka = "5"
trycka()
End Sub
Private Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click
klicka = "6"
trycka()
End Sub
Private Sub Button7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button7.Click
klicka = "7"
trycka()
End Sub
Private Sub Button8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button8.Click
klicka = "8"
trycka()
End Sub
Private Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button9.Click
klicka = "9"
trycka()
End Sub
Private Sub Button0_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button0.Click
klicka = "0"
trycka()
End Sub
End Class
•
•
Join Date: Jun 2007
Posts: 22
Reputation:
Solved Threads: 5
Maybe this is useful:
http://www.astahost.com/info.php/c-n...ial_t6605.html
http://www.astahost.com/info.php/c-n...ial_t6605.html
The issue is because a normal ASP.NET page executes server side. Timers are run client side. You can use a timer on a webpage, but you need to use AJAX.
Go to www.asp.net and download the AJAX extension for VS 2005. You will then see the timer control.
Best/Eric
Go to www.asp.net and download the AJAX extension for VS 2005. You will then see the timer control.
Best/Eric
--
"Dummy."
"Dummy."
![]() |
Similar Threads
- Visual Basic Timer/Clock/Countdown. (Visual Basic 4 / 5 / 6)
- Creating a coundown timer in a form (VB.NET)
- Text Timer (Visual Basic 4 / 5 / 6)
- Setting Timer/Clock Precision (Visual Basic 4 / 5 / 6)
- Visualbasic - Timer Interval Help (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: web browser question
- Next Thread: Dice Game
Views: 1767 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters picturebox picturebox1 port position print printing problem read remove save searchbox searchvb.net select serial server shutdown soap sorting survey syntax table tcp temperature text textbox timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio2008 web webbrowser winforms wpf year





