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

Visual Basic

 
AnswerRe: Publish the vb.net application for only one user Pin
DaveAuld11-Nov-10 20:10
professionalDaveAuld11-Nov-10 20:10 
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 
currrently my thermistor is able to capture temperature however after i click on checkbox1 it display Conversion from string "" to type 'Integer' is not valid please advise thanks
VB
Imports System.Speech.Synthesis

Public Class Form1
Dim FromSerialPort1 As String
Dim XX(100) As Integer
Dim YY(100) As Integer
Dim ZZ(100) As Integer
Dim Flag As Integer
Dim Speaker_Flag As Integer = 0
Dim FromSerialPort_Temp
Dim Thermistor_Temp(15) As Integer
Dim Thermistor_R(15) As Integer
Dim Circuit_Thermistor_R As Double
Dim Result
Dim Counter As Integer
Dim Temperature_low
Dim Temperature_high
Dim Resistance_low
Dim Resistance_high
Dim Rnum1
Dim Rnum2
Dim Speaker As New SpeechSynthesizer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TimerSpeak2.Enabled = True
TimerTemp.Enabled = True
Private Sub ReadSerialPortForTemp()
FromSerialPort_Temp = SerialPortTemp.ReadExisting

If Len(FromSerialPort_Temp) <> 0 Then
TextBoxVoltage.Text = 0.01 * Convert.ToInt16(FromSerialPort_Temp.SubString(2, 3), 16)

Else
FromSerialPort_Temp = "U1000"
End If
End Sub
Private Sub OpenPort1()
If SerialPortTemp.IsOpen Then
SerialPortTemp.Close()

End If

SerialPortTemp.PortName = "Com4"
SerialPortTemp.BaudRate = 9600
SerialPortTemp.Parity = System.IO.Ports.Parity.None
SerialPortTemp.DataBits = 8
SerialPortTemp.StopBits = System.IO.Ports.StopBits.One

SerialPortTemp.RtsEnable = True
SerialPortTemp.Open()

End Sub
Private Sub ThermistorTable()
Thermistor_Temp(0) = -10
Thermistor_R(0) = 42506

Thermistor_Temp(1) = -5
Thermistor_R(1) = 33892

Thermistor_Temp(2) = 0
Thermistor_R(2) = 27219

Thermistor_Temp(3) = 5
Thermistor_R(3) = 22021

Thermistor_Temp(4) = 10
Thermistor_R(4) = 17926

Thermistor_Temp(5) = 15
Thermistor_R(5) = 14674

Thermistor_Temp(6) = 20
Thermistor_R(6) = 12081

Thermistor_Temp(7) = 25
Thermistor_R(7) = 10000

Thermistor_Temp(8) = 30
Thermistor_R(8) = 8315

Thermistor_Temp(9) = 35
Thermistor_R(9) = 6948

Thermistor_Temp(10) = 40
Thermistor_R(10) = 5834

Thermistor_Temp(11) = 45
Thermistor_R(11) = 4917

Thermistor_Temp(12) = 50
Thermistor_R(12) = 4161

Thermistor_Temp(13) = 55
Thermistor_R(13) = 3535

Thermistor_Temp(14) = 60
Thermistor_R(14) = 3014

Thermistor_Temp(15) = 1000
Thermistor_R(15) = 1



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

If Counter = 0 Or Counter = 15 Then
TextBoxTemp.Text = "Out Of Range"
Exit For
End If
End If
End If
Next
End Sub


Private Sub TimerTemp_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerTemp.Tick
Call OpenPort1()

TextBoxVoltage.Clear()
TextBoxResistance.Clear()
TextBoxTemp.Clear()
SerialPortTemp.WriteLine("U1" + vbCr)
System.Threading.Thread.Sleep(150)

Call ReadSerialPortForTemp()

If Len(TextBoxVoltage.Text) = 0 Then
Else
Circuit_Thermistor_R = 10000 * TextBoxVoltage.Text / (5 - TextBoxVoltage.Text)
TextBoxResistance.Text = Math.Round(Circuit_Thermistor_R, 0)
Call ThermistorTable()

End If
End Sub

Private Sub TimerSpeak2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerSpeak2.Tick
Call ThermistorTable()
If CheckBox1.Checked = True Then //from this part 
Call ThermistorTable()
If Result >= 0 Then
TextBox.Text = ""
TextBox.Text = "Your Temperature is" + "" + TextBoxTemp.Text
TextBox.Refresh()
Speaker.Speak(TextBox.Text)
End If //to this part

GeneralRe: progam of checkbox Pin
_Erik_15-Nov-10 5:30
_Erik_15-Nov-10 5:30 
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 

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.