Click here to Skip to main content
15,913,144 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: calculator accept "/" and "+" when I press from keyboard numlock Pin
N a v a n e e t h16-Aug-09 18:33
N a v a n e e t h16-Aug-09 18:33 
AnswerRe: calculator accept "/" and "+" when I press from keyboard numlock Pin
Paramu197316-Aug-09 20:13
Paramu197316-Aug-09 20:13 
QuestionTimers and Threads Pin
rspercy6516-Aug-09 17:24
rspercy6516-Aug-09 17:24 
AnswerRe: Timers and Threads Pin
N a v a n e e t h16-Aug-09 18:31
N a v a n e e t h16-Aug-09 18:31 
GeneralRe: Timers and Threads Pin
rspercy6517-Aug-09 0:54
rspercy6517-Aug-09 0:54 
GeneralRe: Timers and Threads Pin
Johan Hakkesteegt17-Aug-09 2:01
Johan Hakkesteegt17-Aug-09 2:01 
GeneralRe: Timers and Threads Pin
rspercy6517-Aug-09 3:12
rspercy6517-Aug-09 3:12 
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 

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.