Click here to Skip to main content
15,923,845 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Timers and Threads Pin
Johan Hakkesteegt17-Aug-09 3:47
Johan Hakkesteegt17-Aug-09 3:47 
You're welcome.

By the way, the code you posted contains some flaws that will cause part of the code to never execute:
Private Sub TMPTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TMPTimer.Tick
        If oldTemp < newTemp Then
            oldTemp += 1
            DirectCast((Me.BaseUI1.Frame(0)), CircularFrame).ScaleCollection(0).Pointer(0).Value = oldTemp

'The following code will never be executed
'because you already established that oldTemp is smaller than newTemp:
            If oldTemp = newTemp Then
                oldTemp = newTemp
                DirectCast(Me.BaseUI1.Frame(0).FrameCollection(0), NumericalFrame).Indicator.DisplayValue = oldTemp.ToString() & "°"
                TMPTimer.Enabled = False
            End If
        End If

        If oldTemp > newTemp Then
            oldTemp -= 1
            DirectCast((Me.BaseUI1.Frame(0)), CircularFrame).ScaleCollection(0).Pointer(0).Value = oldTemp

'The following code will never be executed
'because you already established that oldTemp is larger than newTemp:
            If oldTemp = newTemp Then
                oldTemp = newTemp
                DirectCast(Me.BaseUI1.Frame(0).FrameCollection(0), NumericalFrame).Indicator.DisplayValue = oldTemp.ToString() & "°"
                TMPTimer.Enabled = False
            End If
        End If
    End Sub


Move the bit that is the same in both:
Private Sub TMPTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TMPTimer.Tick
'Is it smaller?
        If oldTemp < newTemp Then
            oldTemp += 1
            DirectCast((Me.BaseUI1.Frame(0)), CircularFrame).ScaleCollection(0).Pointer(0).Value = oldTemp

        End If

'Is it larger?
        If oldTemp > newTemp Then
            oldTemp -= 1
            DirectCast((Me.BaseUI1.Frame(0)), CircularFrame).ScaleCollection(0).Pointer(0).Value = oldTemp

        End If

'Is it the same?
        If oldTemp = newTemp Then
             oldTemp = newTemp
             DirectCast(Me.BaseUI1.Frame(0).FrameCollection(0), NumericalFrame).Indicator.DisplayValue = oldTemp.ToString() &amp; "°"
             TMPTimer.Enabled = False
         End If

    End Sub


My advice is free, and you may get what you paid for.

GeneralRe: Timers and Threads Pin
rspercy6517-Aug-09 6:55
rspercy6517-Aug-09 6:55 
GeneralRe: Timers and Threads Pin
Johan Hakkesteegt17-Aug-09 20:09
Johan Hakkesteegt17-Aug-09 20:09 
QuestionAbout Excel Automation -----&gt;Import & Export&lt;-------- Pin
Zizo_nis16-Aug-09 3:45
Zizo_nis16-Aug-09 3:45 
AnswerRe: About Excel Automation -----&gt;Import & Export&lt;-------- Pin
Suresh Suthar16-Aug-09 20:12
professionalSuresh Suthar16-Aug-09 20:12 
Questioncode to find max orderno Pin
AjitMourya16-Aug-09 2:21
AjitMourya16-Aug-09 2:21 
AnswerRe: code to find max orderno Pin
riced16-Aug-09 2:40
riced16-Aug-09 2:40 
AnswerRe: code to find max orderno Pin
Zizo_nis16-Aug-09 2:45
Zizo_nis16-Aug-09 2:45 
GeneralRe: code to find max orderno Pin
AjitMourya16-Aug-09 19:49
AjitMourya16-Aug-09 19:49 
AnswerRe: code to find max orderno Pin
Eddy Vluggen16-Aug-09 3:02
professionalEddy Vluggen16-Aug-09 3:02 
GeneralRe: code to find max orderno Pin
Zizo_nis16-Aug-09 3:50
Zizo_nis16-Aug-09 3:50 
GeneralRe: code to find max orderno Pin
Eddy Vluggen16-Aug-09 5:05
professionalEddy Vluggen16-Aug-09 5:05 
GeneralRe: code to find max orderno Pin
AjitMourya16-Aug-09 19:58
AjitMourya16-Aug-09 19:58 
GeneralRe: code to find max orderno Pin
Eddy Vluggen16-Aug-09 21:10
professionalEddy Vluggen16-Aug-09 21:10 
GeneralRe: code to find max orderno Pin
AjitMourya16-Aug-09 19:30
AjitMourya16-Aug-09 19:30 
AnswerRe: code to find max orderno Pin
Johan Hakkesteegt16-Aug-09 21:01
Johan Hakkesteegt16-Aug-09 21:01 
QuestionVB Sql check and insert if then command Pin
Brav0116-Aug-09 0:56
Brav0116-Aug-09 0:56 
AnswerRe: VB Sql check and insert if then command Pin
Moreno Airoldi16-Aug-09 1:12
Moreno Airoldi16-Aug-09 1:12 
GeneralRe: VB Sql check and insert if then command Pin
Brav0116-Aug-09 2:02
Brav0116-Aug-09 2:02 
AnswerRe: VB Sql check and insert if then command Pin
Paramu197316-Aug-09 20:20
Paramu197316-Aug-09 20:20 
QuestionUnchecking a checked box... Answered,thanks. Pin
Laser Steve15-Aug-09 6:26
Laser Steve15-Aug-09 6:26 
AnswerRe: Unchecking a checked box Pin
Dave Kreskowiak15-Aug-09 6:45
mveDave Kreskowiak15-Aug-09 6:45 
AnswerRe: Unchecking a checked box... Answered,thanks. Pin
Laser Steve15-Aug-09 7:15
Laser Steve15-Aug-09 7:15 
QuestionComboLost focus problem.? Pin
mdrizwan_115-Aug-09 2:54
mdrizwan_115-Aug-09 2:54 
AnswerRe: ComboLost focus problem.? Pin
riced15-Aug-09 3:04
riced15-Aug-09 3:04 

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.