EXCEL TOOLS
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
Excel Add-ins ที่พัฒนาโดยคุณสันติพงศ์ ณสุย (MVP Excel 2010-2020) ด้วยภาษา C# เพื่อแก้ไขปัญหาไฟล์ใหญ่ คำนวณนาน ทำงานช้า จัดการข้อมูลต่าง ๆ ที่ทำงานประจำวันได้อย่างสะดวกรวดเร็ว สนใจคลิกไปดูได้ที่นี่ครับ => Excel Tools
[code]
และปิดด้วย [/code]
ตัวอย่างเช่น [code]dim r as range[/code]
เพื่อให้แตกต่างจากข้อความทั่วไป สะดวกในการอ่านและทดสอบ (คลิกเพื่อดูตัวอย่างเพิ่มเติม)Code: Select all
Public Sub btnTransfer_Click(sender As Object, e As EventArgs) Handles btnTransfer.Click
If txtMaximumTank.Text <= txtVolumeWater.Text Then
Dim result14 As DialogResult = MessageBox.Show("The capacity of the tank is less than that required to maintain the water level.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
If txtMaximumTank.Text = "" Then
Dim result As DialogResult = MessageBox.Show("Please you specify maximum capacity of tank.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End If
If txtVolumeWater.Text >= txtMaximumTank.Text Then
Dim result15 As DialogResult = MessageBox.Show("The water level you specify exceeds tank capacity.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
If txtVolumeWater.Text = "" Then
Dim result1 As DialogResult = MessageBox.Show("Please you specify level water do you need maintain.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
' result1.OK Then
'txtVolumeWater.Text = (txtMaximumTank.Text - 2)
'End If
End If
End If
If txtCapacityA.Text = "" Then
Dim result2 As DialogResult = MessageBox.Show("Please you speccify capacity of bottle fertilizer A.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtCapacityB.Text = "" Then
Dim result3 As DialogResult = MessageBox.Show("Please you speccify capacity of bottle fertilizer B.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtFertilizerA.Text = "" Then
Dim result4 As DialogResult = MessageBox.Show("Fertilizer A 2 CC. per liquid 1 liter.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtFertilizerB.Text = "" Then
Dim result5 As DialogResult = MessageBox.Show("Fertilizer B 2 CC. per liquid 1 liter.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtTemp.Text = "" Then
Dim result6 As DialogResult = MessageBox.Show("Please you specify temperature value of water (should not more than 35 °C.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtHumidity.Text = "" Then
Dim result7 As DialogResult = MessageBox.Show("Please you specify Humidity value for control. (Should between value 40-60 %Rh.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtEc.Text = "" Then
Dim result8 As DialogResult = MessageBox.Show("Please you specify EC value.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtEC2.Text = "" Then
Dim result16 As DialogResult = MessageBox.Show("Please you specify EC value.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtEC3.Text = "" Then
Dim result17 As DialogResult = MessageBox.Show("Please you specify EC value.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtEC4.Text = "" Then
Dim result18 As DialogResult = MessageBox.Show("Please you specify EC value.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If CheckBox1.Checked = True Then
If txtpHMin.Text Or txtpHMax.Text = "" Then
Dim result9 As DialogResult = MessageBox.Show("Please you specify pH value (The value should between 5.5 - 6.2)", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Question)
'Exit Sub
End If
ElseIf CheckBox1.Checked = False Then
Dim result13 As DialogResult = MessageBox.Show("pH function closed.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Question)
End If
If TextBox5.Text = "" Then
Dim result10 As DialogResult = MessageBox.Show("Please you specify time of grow.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If TextBox3.Text = "" Then
Dim result11 As DialogResult = MessageBox.Show("Please you specify time for delay before put fertilizer B.", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
If txtFlowwater.Text = "" Then
Dim result12 As DialogResult = MessageBox.Show("Please you specify time for flow normal water", "System message : ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
Dim variableTank As Integer = txtMaximumTank.Text
Dim variableVolumeTank As Integer = txtVolumeWater.Text
Dim capacityA As Integer = txtCapacityA.Text
Dim capacityB As Integer = txtCapacityB.Text
Dim variableTemp As Integer = txtTemp.Text
Dim variableHumi As Integer = txtHumidity.Text
Dim variableEC As Double = txtEc.Text
Dim variableEC2 As Double = txtEC2.Text
Dim variableEC3 As Double = txtEC3.Text
Dim variableEC4 As Double = txtEC4.Text
Dim variableA As Integer = txtFertilizerA.Text
Dim variableB As Integer = txtFertilizerB.Text
Dim variablepHMin As Double = (CDbl(txtpHMin.Text))
Dim variablepHMax As Double = (CDbl(txtpHMax.Text))
Dim variablephMin2 As Double = 1.0
Dim variablephMax2 As Double = 1.0
Dim variableDay As Integer = TextBox5.Text
Dim variableMin As Integer = TextBox3.Text
Dim variableFlow As Integer = txtFlowwater.Text
PumpFlow = 2
ValveFeedin = 2
ValveFeedout = 2
PumpA = 2
PumpB = 2
ValveFogger = 2
If CheckBox1.Checked = True Then
data = ("" & variableTank & "" & variableVolumeTank & "" & capacityA & "" & capacityB & "" & variableA & "" & variableB & "" & variableTemp & "" & variableHumi & "" & (variableEC * 10) & "" & (variableEC2 * 10) & "" & (variableEC3 * 10) & "" & (variableEC4 * 10) & "" & (variablepHMin * 10) & "" & (variablepHMax * 10) & "" & variableDay & "" & variableMin & "" & variableFlow & "" & PumpFlow & "" & ValveFeedin & "" & ValveFeedout & "" & PumpA & "" & PumpB & "" & ValveFogger & "\")
ElseIf CheckBox1.Checked = False Then
data = ("" & variableTank & "" & variableVolumeTank & "" & capacityA & "" & capacityB & "" & variableA & "" & variableB & "" & variableTemp & "" & variableHumi & "" & (variableEC * 10) & "" & (variableEC2 * 10) & "" & (variableEC3 * 10) & "" & (variableEC4 * 10) & "" & (variablephMin2 * 10) & "" & (variablephMax2 * 10) & "" & variableDay & "" & variableMin & "" & variableFlow & "" & PumpFlow & "" & ValveFeedin & "" & ValveFeedout & "" & PumpA & "" & PumpB & "" & ValveFogger & "\")
End If
ListBox1.Items.Add(data)
'SerialPort1.PortName = comport
'SerialPort1.BaudRate = baudrate
'SerialPort1.Open()
'If SerialPort1.IsOpen Then
'SerialPort1.WriteLine(data)
'SerialPort1.Close()
'End If
End Sub
Code: Select all
Dim variableTank As Integer = (CInt(txtMaximumTank.Text))
Dim variableVolumeTank As Integer = txtVolumeWater.Text
Dim capacityA As Integer = txtCapacityA.Text
Dim capacityB As Integer = txtCapacityB.Text
Dim variableTemp As Integer = txtTemp.Text
Dim variableHumi As Integer = txtHumidity.Text
Dim variableEC As Double = txtEc.Text
Dim variableEC2 As Double = txtEC2.Text
Dim variableEC3 As Double = txtEC3.Text
Dim variableEC4 As Double = txtEC4.Text
Dim variableA As Integer = txtFertilizerA.Text
Dim variableB As Integer = txtFertilizerB.Text
Dim variablepHMin As Double = (CDbl(txtpHMin.Text))
Dim variablepHMax As Double = (CDbl(txtpHMax.Text))
Dim variablephMin2 As Double = 1.0
Dim variablephMax2 As Double = 1.0
Dim variableDay As Integer = TextBox5.Text
Dim variableMin As Integer = TextBox3.Text
Dim variableFlow As Integer = txtFlowwater.Text
PumpFlow = 0
'data = ("" & variableTank & "" & variableVolumeTank & "" & variableTemp & "" & variableHumi & "" & (variableEC * 10) & "" & variableA & "" & variableB & "" & variableDay & "" & variableMin & "" & (variablepHMin * 10) & "" & (variablepHMax * 10) & "\")
If CheckBox1.Checked = True Then
data = ("" & variableTank & "" & variableVolumeTank & "" & capacityA & "" & capacityB & "" & variableA & "" & variableB & "" & variableTemp & "" & variableHumi & "" & (variableEC * 10) & "" & (variableEC2 * 10) & "" & (variableEC3 * 10) & "" & (variableEC4 * 10) & "" & (variablepHMin * 10) & "" & (variablepHMax * 10) & "" & variableDay & "" & variableMin & "" & variableFlow & "" & PumpFlow & "" & ValveFeedin & "" & ValveFeedout & "" & PumpA & "" & PumpB & "" & ValveFogger & "\")
ElseIf CheckBox1.Checked = False Then
data = ("" & variableTank & "" & variableVolumeTank & "" & capacityA & "" & capacityB & "" & variableA & "" & variableB & "" & variableTemp & "" & variableHumi & "" & (variableEC * 10) & "" & (variableEC2 * 10) & "" & (variableEC3 * 10) & "" & (variableEC4 * 10) & "" & (variablephMin2 * 10) & "" & (variablephMax2 * 10) & "" & variableDay & "" & variableMin & "" & variableFlow & "" & PumpFlow & "" & ValveFeedin & "" & ValveFeedout & "" & PumpA & "" & PumpB & "" & ValveFogger & "\")
End If
'data1 = ("" & txtMaximumTank.Text & "\")
ListBox1.Items.Add(data)
'SerialPort1.PortName = comport
'SerialPort1.BaudRate = baudrate
'SerialPort1.Open()
'If SerialPort1.IsOpen Then
'SerialPort1.WriteLine(data)
'SerialPort1.Close()
'End If
End Sub
ตัวแปร txtMaximumtank
อยู่ก่อนที่จะคลิกปุ่มอื่น