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
SerialPort1.Write(Volume(0))
SerialPort1.Write(Volume(1))
SerialPort1.Write(Volume(2))
SerialPort1.Write(Volume(3))
Code: Select all
Public Class Form1
Private Sub Button1_Click(sender As System.Object, _
e As System.EventArgs) Handles Button1.Click
Dim s() As String
Dim i As Integer
Dim iCount As Integer
i = Len(TextBox1.Text)
ReDim s(i)
For iCount = 1 To i
s(iCount) = Mid(TextBox1.Text, iCount, 1)
MsgBox("Volume " & iCount & " = " & s(iCount))
Next
End Sub
End Class
Code: Select all
Public Class Form1
Delegate Sub SetTextCallback(ByVal [text] As String)
Dim Volume As Integer
Dim cycle As Integer = 0
Private Sub Volume_Need_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Volume_Need.TextChanged
If Volume_Need.Text = "" Then
Volume = 0
Exit Sub
End If
If Not IsNumeric(Volume_Need.Text) Then
MessageBox.Show("กรุณาใส่ค่าเป็นตัวเลขตั้งแต่ 0 - 5 ml ครับ")
Volume_Need.Text = ""
End If
End Sub
Private Sub Send3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Send3.Click
If Volume_Need.Text = "" Then
Volume = 0
Else : Volume = Volume_Need.Text
End If
'////////////////////////////////////////////////////////////////////////////
If Num_cycle.Text = "" Then
cycle = 0
Else : cycle = Num_cycle.Text
End If
'////////////////////////////////////////////////////////////////////////////
If (Up_botton.Checked = True) And (Volume_Need.Text <> "") Then
Command_list.Items.Add(" Syringe UP : " + CStr(Volume) + " µL")
ElseIf (Down_botton.Checked = True) And (Volume_Need.Text <> "") Then
Command_list.Items.Add(" Syringe Down : " + CStr(Volume) + " µL")
End If
If (Swing_botton.Checked = True) And (Num_cycle.Text <> "") Then
Command_list.Items.Add(" Syringe Swing : " + CStr(cycle) + " cycle")
End If
End Sub
Private Sub Start_botton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_botton.Click
Dim a As Object
For Each a In Command_list.Items
If a = " Syringe UP : " + CStr(Volume) + " µL" Then
SerialPort1.Write("U")
MessageBox.Show("UP")
SerialPort1.Write(CStr(Volume))
MessageBox.Show(Volume)
SerialPort1.Write("E")
MessageBox.Show("E")
'///////////////////////// UP //////////////////////////////////
ElseIf a = " Syringe Down : " + CStr(Volume) + " µL" Then
SerialPort1.Write("D")
MessageBox.Show("Down")
SerialPort1.Write(CStr(Volume))
MessageBox.Show(Volume)
SerialPort1.Write("E")
MessageBox.Show("E")
'//////////////////////////////// DOWN ////////////////////////////
ElseIf a = " Syringe Swing : " + CStr(cycle) + " cycle" Then
SerialPort1.Write("G")
MessageBox.Show("Swing")
SerialPort1.Write(CStr(cycle))
MessageBox.Show(cycle)
SerialPort1.Write("E")
MessageBox.Show("E")
'/////////////////////////////// Swing ////////////////////////////////
ElseIf a = " Selection valve : Water" Then
SerialPort1.Write("W")
MessageBox.Show("Water")
SerialPort1.Write("E")
MessageBox.Show("End")
'///////////////////////////// Water ///////////////////////////////////
ElseIf a = " Selection valve : Solution1" Then
SerialPort1.Write("S")
MessageBox.Show("Solution1")
SerialPort1.Write("E")
MessageBox.Show("End")
'//////////////////////////// Solution1 /////////////////////////////////
End If
Next
End Sub
End Class
Code: Select all
Private Sub Start_botton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_botton.Click
Dim a As Object = 0 'Set ไว้สำหรับเปรียบเทียบ ค่าจาก Listbox
Dim s As String
Dim t As String = "0123456789"
Dim i As Integer
'On Error Resume Next
For Each a In Command_list.Items
s = ""
For i = 1 To Len(a)
If InStr(t, Mid(a, i, 1)) > 0 Then
s = s & Mid(a, i, 1)
End If
Next
'If a = " Syringe UP : " + CStr(Volume) + " µL" Then
If Mid(a, 1, 14) = " Syringe UP : " And Mid(a, Len(a) - 2, 3) = " µL" Then
MsgBox(Mid(a, Len(a) - 2, 3))
SerialPort1.Write("U")
MessageBox.Show("UP")
SerialPort1.Write(s)
MessageBox.Show(s)
SerialPort1.Write("E")
MessageBox.Show("E")
'///////////////////////// UP //////////////////////////////////
'ElseIf a = " Syringe Down : " + CStr(Volume) + " µL" Then
ElseIf Mid(a, 1, 16) = " Syringe Down : " And Mid(a, Len(a) - 2, 3) = " µL" Then
SerialPort1.Write("D")
MessageBox.Show("Down")
SerialPort1.Write(CStr(Volume))
MessageBox.Show(Volume)
SerialPort1.Write("E")
MessageBox.Show("E")
'//////////////////////////////// DOWN ////////////////////////////
'ElseIf a = " Syringe Swing : " + CStr(cycle) + " cycle" Then
ElseIf Mid(a, 1, 17) = " Syringe Swing : " And Mid(a, Len(a) - 5, 6) = " cycle" Then
SerialPort1.Write("G")
MessageBox.Show("Swing")
SerialPort1.Write(CStr(cycle))
MessageBox.Show(cycle)
SerialPort1.Write("E")
MessageBox.Show("E")
'/////////////////////////////// Swing ////////////////////////////////
ElseIf a = " Selection valve : Water" Then
SerialPort1.Write("W")
MessageBox.Show("Water")
'///////////////////////////// Water ///////////////////////////////////
ElseIf a = " Selection valve : Solution1" Then
SerialPort1.Write("S")
MessageBox.Show("Solution1")
'//////////////////////////// Solution1 /////////////////////////////////
End If
Next
SerialPort1.Write("C")
MessageBox.Show("Complete")
End Sub