Click here to Skip to main content
15,898,371 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Publish the vb.net application for only one user Pin
vijay248211-Nov-10 23:10
vijay248211-Nov-10 23:10 
QuestionSystem.Timers.Timer Event Handling with Web Message Box Pin
ggoutam711-Nov-10 18:09
ggoutam711-Nov-10 18:09 
AnswerRe: System.Timers.Timer Event Handling with Web Message Box Pin
Dave Kreskowiak12-Nov-10 3:40
mveDave Kreskowiak12-Nov-10 3:40 
GeneralRe: System.Timers.Timer Event Handling with Web Message Box Pin
ggoutam715-Nov-10 20:26
ggoutam715-Nov-10 20:26 
Questionprogam of checkbox Pin
Assinateq10-Nov-10 19:04
Assinateq10-Nov-10 19:04 
AnswerRe: progam of checkbox PinPopular
_Erik_11-Nov-10 1:24
_Erik_11-Nov-10 1:24 
GeneralRe: progam of checkbox Pin
Assinateq14-Nov-10 23:06
Assinateq14-Nov-10 23:06 
GeneralRe: progam of checkbox Pin
_Erik_15-Nov-10 5:30
_Erik_15-Nov-10 5:30 
Though I do not usually do this, I have spent five minutes to parse your code snippet correctly. What I can see is that Thermistor_Temp and Thermistor_R arrays have always the same values, so you should better initialize them just once in the constructor, becouse you are now initializing them with the same values every time you call ThermistorTable.

In this loop in ThermistorTable method:

VB
For Counter = 0 To 15
    If CInt(TextBoxResistance.Text) >= Thermistor_R(Counter) Then

        If Counter <> 0 And Counter <> 15 Then
            Temperature_high = Thermistor_Temp(Counter)
            Temperature_low = Thermistor_Temp(Counter - 1)
            Resistance_low = Thermistor_R(Counter)
            Resistance_high = Thermistor_R(Counter - 1)
            Rnum1 = Resistance_high - TextBoxResistance.Text
            Rnum2 = Resistance_high - Resistance_low
            Result = 2.5 + Math.Round(Temperature_low + (5 * Rnum1 / Rnum2), 1)
            TextBoxTemp.Text = Result & "C"
            Exit For

            
            ' This condition will never be true
            If Counter = 0 Or Counter = 15 Then
                TextBoxTemp.Text = "Out Of Range"
                Exit For
            End If
        End If

    End If

Next


I guess you are looking for the first value on your array which is lesser or equal to what you have in TextBoxResistance. Not too bad, but somewhat confusing, and the last if will never run. I would have done it this way:

VB
Dim r As Integer = CInt(TextBoxResistance.Text)
Dim idx As Integer = 0

While r < Thermistor_R(idx) And idx < 15
    idx += 1
End While

If (idx = 0 Or idx = 15) Then
    TextBoxTemp.Text = "Out Of Range"
Else
    Temperature_high = Thermistor_Temp(idx)
    Temperature_low = Thermistor_Temp(idx - 1)
    Resistance_low = Thermistor_R(idx)
    Resistance_high = Thermistor_R(idx - 1)
    Rnum1 = Resistance_high - r
    Rnum2 = Resistance_high - Resistance_low
    Result = 2.5 + Math.Round(Temperature_low + (5 * Rnum1 / Rnum2), 1)
    TextBoxTemp.Text = Result & "C"
End If


Anyhow, you get an error trying to convert a string to an Integer. It must be becouse you try to convert a TextBox.Text property before you have initialized its value, so it has nothing to do with your CheckBox. Like you are using different timers to read and modify the values, I think you have not synchronized them correctly.

On the other hand, this is too much UI dependent. I would rather encapsulate all this stuff within a class and use just one timer to update the UI controls with the values this class returns.
GeneralRe: progam of checkbox Pin
Assinateq15-Nov-10 14:31
Assinateq15-Nov-10 14:31 
Questionlet captured temperature store in limited database slot and run in loop Pin
kun8510-Nov-10 19:00
kun8510-Nov-10 19:00 
AnswerRe: let captured temperature store in limited database slot and run in loop Pin
Luc Pattyn11-Nov-10 0:08
sitebuilderLuc Pattyn11-Nov-10 0:08 
AnswerRe: let captured temperature store in limited database slot and run in loop Pin
kun8511-Nov-10 16:02
kun8511-Nov-10 16:02 
QuestionEmbedded Resource xml help. [modified] Pin
crain198110-Nov-10 14:03
crain198110-Nov-10 14:03 
AnswerRe: Embedded Resource xml help. Pin
_Erik_11-Nov-10 1:16
_Erik_11-Nov-10 1:16 
GeneralRe: Embedded Resource xml help. Pin
crain198111-Nov-10 12:49
crain198111-Nov-10 12:49 
GeneralRe: Embedded Resource xml help. Pin
Dave Kreskowiak11-Nov-10 12:54
mveDave Kreskowiak11-Nov-10 12:54 
GeneralRe: Embedded Resource xml help. Pin
_Erik_11-Nov-10 13:20
_Erik_11-Nov-10 13:20 
GeneralRe: Embedded Resource xml help. Pin
crain198111-Nov-10 13:23
crain198111-Nov-10 13:23 
GeneralRe: Embedded Resource xml help. Pin
_Erik_11-Nov-10 13:58
_Erik_11-Nov-10 13:58 
QuestionApplication Security - Advice Pin
Simon_Whale10-Nov-10 5:32
Simon_Whale10-Nov-10 5:32 
AnswerRe: Application Security - Advice Pin
_Erik_10-Nov-10 6:59
_Erik_10-Nov-10 6:59 
GeneralRe: Application Security - Advice [modified] Pin
Simon_Whale10-Nov-10 9:06
Simon_Whale10-Nov-10 9:06 
AnswerRe: Application Security - Advice Pin
Dave Kreskowiak10-Nov-10 7:30
mveDave Kreskowiak10-Nov-10 7:30 
GeneralRe: Application Security - Advice Pin
Simon_Whale10-Nov-10 9:03
Simon_Whale10-Nov-10 9:03 
AnswerRe: Application Security - Advice Pin
Eddy Vluggen10-Nov-10 7:43
professionalEddy Vluggen10-Nov-10 7:43 

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.