提供しているソフトウェアのコードは以下のコードとなっております。
Imports System.IO.Ports '=========================================================== ' ' ズームレンズコントローラー ' サンプルプログラム ' 2017 TESBIT co.,ltd. ' http://tesbit.co.jp ' '=========================================================== Public Class f_zlc Private COMSelected = False Private COMPort As String = "COM7" Private DEMO_MODE As Boolean = False Private strStatus As String = "" Private booting As Boolean = True Private PosZoom As Integer = 0 Private PosFocus As Integer = 0 Private PosIris As Integer = 0 Const BAUD_RATE As Integer = 38400 Private sendf As Boolean = False '送信済みフラグ Private move_af As Boolean = False 'move_aフラグ(move_p追加) Private init_af As Boolean = False 'init_aフラグ Delegate Sub UpdateDelegate() Delegate Sub enableDelegate() Dim tt_val As ToolTip Dim init_a_f As Boolean = False 'フォーム構築・初期化 Private Sub f_zlc_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Me.tt_val = New ToolTip(Me.components) ''ポートリスト取得 Dim portList() As String portList = SerialPort.GetPortNames Dim i As Integer '初期化ファイルの読み込み If System.IO.File.Exists("ZLCinit.ini") = False Then NoSettings: 'コンボボックス初期化 Me.cb_com.Items.Add("未設定") For i = 0 To portList.Length - 1 Me.cb_com.Items.Add(portList(i)) Next Me.cb_com.EndUpdate() Me.cb_com.SelectedIndex = 0 '確認メッセージ MsgBox("設定ファイルが存在しません。" + vbCrLf + "COMポートを選択してください。", MsgBoxStyle.OkOnly, "COMエラー") booting = False Return Else 'ファイルの読み込み If Me.readInitFile() = False Then GoTo NoSettings End If For i = 0 To portList.Length - 1 Me.cb_com.Items.Add(portList(i)) Next Me.cb_com.EndUpdate() Me.cb_com.Text = Me.COMPort 'COMの初期化 Try With COM .PortName = Me.COMPort .Parity = Parity.None '.BaudRate = 38400 .BaudRate = BAUD_RATE .DataBits = 8 .StopBits = 1 .Open() End With Catch ex As Exception MsgBox("COMの初期化でエラーが発生しました。" + vbCrLf + ex.Message, MsgBoxStyle.OkOnly, "COMエラー") booting = False Return End Try 'TSZCをリセット(DtrEnable = True)する Me.COM_SEND("reset") 'インチング速度設定 Me.COM_SEND("s_incz,100") Me.COM_SEND("s_incf,100") Me.COM_SEND("s_inci,100") '現在値の取得 Me.COM_SEND("read_a") booting = False End If End Sub '終了処理 Private Sub f_zlc_Disposed(sender As Object, e As System.EventArgs) Handles Me.Disposed If Me.COM.IsOpen Then Me.COM.Close() End If Me.COM.Dispose() '設定の保存 Me.saveInitFile() End Sub 'COMコンボボックス Private Sub cb_com_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cb_com.SelectedIndexChanged If Me.booting = True Then Return End If If Me.cb_com.SelectedText.Equals("未設定") Then Return Else If Me.COM.IsOpen = True Then Me.COM.Close() End If Me.COMPort = Me.cb_com.SelectedItem.ToString 'COMの初期化 Try With COM .PortName = Me.COMPort .Parity = Parity.None '.BaudRate = 9600 .BaudRate = BAUD_RATE .DataBits = 8 .StopBits = 1 .Open() End With Catch ex As Exception MsgBox("COMの初期化でエラーが発生しました。" + vbCrLf + ex.Message, MsgBoxStyle.OkOnly, "COMエラー") End Try 'TSZCをリセット(DtrEnable = True)する Me.COM_SEND("reset") 'インチング速度設定 Me.COM_SEND("s_incz,100") Me.COM_SEND("s_incf,100") Me.COM_SEND("s_inci,100") '現在値の取得 Me.COM_SEND("read_a") End If End Sub '初期化ファイル読み込み Private Function readInitFile() As Boolean Dim i As Integer Dim strRDT() As String Dim strDT() As String Try strRDT = System.IO.File.ReadAllLines("ZLCinit.ini") For i = 0 To strRDT.Length - 1 strDT = strRDT(i).Split(";") Select Case strDT(0) Case "COM" Me.COMPort = strDT(1) Exit Select End Select Next Catch ex As Exception MsgBox("初期化ファイルの読み込みに失敗しました1。" + vbCrLf + ex.Message, MsgBoxStyle.OkOnly, "ファイルエラー") Return False End Try Return True End Function '初期化ファイル保存 Private Function saveInitFile() As Boolean Try Dim str As String = System.String.Empty str += "COM;" + Me.COMPort + vbCrLf Dim sw As System.IO.StreamWriter sw = New System.IO.StreamWriter("ZLCinit.ini", False, System.Text.Encoding.GetEncoding("shift_jis")) sw.Write(str) sw.Close() Catch ex As Exception MsgBox("初期化ファイルの保存に失敗しました。" + vbCrLf + ex.Message, MsgBoxStyle.OkOnly, "ファイルエラー") Return False End Try Return True End Function '=========================================================== ' ' 通信関連 ' ' '=========================================================== 'コマンド定義 Private Enum ZoomRetCMD read_a = 1 read_z = 2 read_f = 3 read_i = 4 move_a = 11 move_z = 12 move_f = 13 move_i = 14 inc_zf = 20 inc_zr = 21 inc_ff = 22 inc_fr = 23 inc_if = 24 inc_ir = 25 instop = 30 init_a = 100 init_a_z = 101 init_a_f = 102 init_a_i = 103 err = 999 standby = 0 End Enum 'コマンド判別 Private Function getZoommCmd(ByRef strDT As String) As ZoomRetCMD Dim CMD As Integer = ZoomRetCMD.standby If strDT.IndexOf("read_a") <> -1 Then CMD = ZoomRetCMD.read_a ElseIf strDT.IndexOf("read_z") <> -1 Then CMD = ZoomRetCMD.read_z ElseIf strDT.IndexOf("read_f") <> -1 Then CMD = ZoomRetCMD.read_f ElseIf strDT.IndexOf("read_i") <> -1 Then CMD = ZoomRetCMD.read_i ElseIf strDT.IndexOf("move_a") <> -1 Then CMD = ZoomRetCMD.move_a ElseIf strDT.IndexOf("move_z") <> -1 Then CMD = ZoomRetCMD.move_z ElseIf strDT.IndexOf("move_f") <> -1 Then CMD = ZoomRetCMD.move_f ElseIf strDT.IndexOf("move_i") <> -1 Then CMD = ZoomRetCMD.move_i ElseIf strDT.IndexOf("inc_ff") <> -1 Then CMD = ZoomRetCMD.inc_ff ElseIf strDT.IndexOf("inc_fr") <> -1 Then CMD = ZoomRetCMD.inc_fr ElseIf strDT.IndexOf("inc_zf") <> -1 Then CMD = ZoomRetCMD.inc_zf ElseIf strDT.IndexOf("inc_zr") <> -1 Then CMD = ZoomRetCMD.inc_zr ElseIf strDT.IndexOf("inc_if") <> -1 Then CMD = ZoomRetCMD.inc_if ElseIf strDT.IndexOf("inc_ir") <> -1 Then CMD = ZoomRetCMD.inc_ir ElseIf strDT.IndexOf("instop") <> -1 Then CMD = ZoomRetCMD.instop ElseIf strDT.IndexOf("init_a_done") <> -1 Then CMD = ZoomRetCMD.init_a ElseIf strDT.IndexOf("init_a_z") <> -1 Then CMD = ZoomRetCMD.init_a_z ElseIf strDT.IndexOf("init_a_f") <> -1 Then CMD = ZoomRetCMD.init_a_f ElseIf strDT.IndexOf("init_a_i") <> -1 Then CMD = ZoomRetCMD.init_a_i ElseIf strDT.IndexOf("Err") <> -1 Then CMD = ZoomRetCMD.err Else CMD = ZoomRetCMD.standby End If Return CMD End Function 'コマンド送信 '同期通信対応 返信がある処理については本関数を通すこと。 Private Function COM_SEND(ByVal strCMD As String) As Boolean '送信フラグON sendf = True If Me.COM.IsOpen Then '発行されたコマンドが"reset"だった場合 If (strCMD = "reset") Then 'リセット(DtrEnable = True)すると「ZLC TESBIT・・」が返信されるため '本関数内処理実行() Me.COM.DtrEnable = True Else '複数の返信があるコマンド If strCMD.IndexOf("move_a") <> -1 Then move_af = True If strCMD.IndexOf("move_p") <> -1 Then move_af = True If strCMD.IndexOf("init_a") <> -1 Then init_af = True 'If Me.cb_delm.Checked Then Me.COM.Write(strCMD + vbCrLf) 'Else 'Me.COM.Write(strCMD) 'End If Me.strStatus = ">" + strCMD + vbCrLf '表示の更新 Invoke(New UpdateDelegate(AddressOf UpdateData)) End If Me.COM.DiscardOutBuffer() End If 'データを受信するまで待機 Dim loopCnt As Integer = 1 While (sendf) 'メッセージキューに現在あるWindowsメッセージをすべて処理する System.Windows.Forms.Application.DoEvents() System.Threading.Thread.Sleep(10) If loopCnt = 20000 Then Me.strStatus = "VBError:timeout" + vbCrLf '表示の更新 Invoke(New UpdateDelegate(AddressOf UpdateData)) sendf = False Return False End If loopCnt = loopCnt + 1 End While Return True End Function 'コマンド受信 '同期通信対応 それに伴い本関数内からのCOM_SENDの実行を禁止。 Private Sub COM_DataReceived(sender As Object, e As System.IO.Ports.SerialDataReceivedEventArgs) Handles COM.DataReceived If Me.COM.IsOpen = False Then Return End If Try Dim strDT As String = Me.COM.ReadLine Me.strStatus = "<" + strDT + vbCrLf Invoke(New UpdateDelegate(AddressOf UpdateData)) '送信フラグOFF If move_af Then If System.Text.RegularExpressions.Regex.IsMatch(strDT, "move_a.*?_done") Then 'move_a(p)を実行した場合move_a(p)_doneが返却されたらOFF If sendf = True Then sendf = False move_af = False End If ElseIf init_af Then If strDT.IndexOf("init_a_done") <> -1 Then 'init_aを実行した場合init_a doneが返却されたらOFF If sendf = True Then sendf = False init_af = False End If Else '上記以外の場合OFF If sendf = True Then sendf = False End If If strDT.IndexOf("ZLC") <> -1 Then 'Me.COM_SEND("read_a") <ZLC TESBIT TSZC-06b End If Select Case getZoommCmd(strDT) Case ZoomRetCMD.standby Exit Select Case ZoomRetCMD.read_a Dim strDTT() As String = strDT.Split(",") If strDTT.Length < 3 Then Exit Select End If Me.PosZoom = Integer.Parse(strDTT(1)) Me.PosFocus = Integer.Parse(strDTT(2)) Me.PosIris = Integer.Parse(strDTT(3)) Me.strStatus = "" Invoke(New UpdateDelegate(AddressOf UpdateData)) Exit Select Case ZoomRetCMD.move_a, _ ZoomRetCMD.move_z, _ ZoomRetCMD.move_f, _ ZoomRetCMD.move_i 'Me.COM_SEND("read_a") 'Invoke(New enableDelegate(AddressOf enableControl)) Exit Select Case ZoomRetCMD.inc_zf, _ ZoomRetCMD.inc_zr, _ ZoomRetCMD.inc_ff, _ ZoomRetCMD.inc_fr, _ ZoomRetCMD.inc_if, _ ZoomRetCMD.inc_ir Exit Select Case ZoomRetCMD.instop 'Me.COM_SEND("read_a") Exit Select Case ZoomRetCMD.init_a 'Me.COM_SEND("move_a,400,600,800") Exit Select Case ZoomRetCMD.init_a_z Exit Select Case ZoomRetCMD.init_a_f Exit Select Case ZoomRetCMD.init_a_i Exit Select Case ZoomRetCMD.err Invoke(New enableDelegate(AddressOf enableControl)) Exit Select End Select Catch ex As Exception Me.strStatus = ex.ToString Invoke(New UpdateDelegate(AddressOf UpdateData)) End Try Me.COM.DiscardInBuffer() End Sub 'エラー受信 Private Sub COM_ErrorReceived(sender As Object, e As System.IO.Ports.SerialErrorReceivedEventArgs) Handles COM.ErrorReceived End Sub '=========================================================== ' ' ボタン操作 ' ' '=========================================================== '送信ボタン Private Sub btn_send_Click(sender As System.Object, e As System.EventArgs) Handles btn_send.Click If Me.tx_comSend.Text = "" Then Return End If Dim str = Me.tx_comSend.Text Dim str_six = str.Substring(0, 6) 'Me.COM_SEND(Me.tx_comSend.Text) Me.COM_SEND(str) Select Case str_six Case "move_a", _ "move_z", _ "move_f", _ "move_i", _ "move_p", _ "init_a", _ "init_z", _ "init_f", _ "init_i", _ "instop" Me.COM_SEND("read_a") Exit Select Case "inchsp" Dim arr = str.Split(",") If arr(0) = 255 Then rb_z255.Checked = True End If Exit Select Case "s_incz" Exit Select Case "s_incf" Exit Select Case "s_inci" Exit Select End Select End Sub 'zoom Private Sub btn_zoomUP_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btn_zoomUP.MouseDown Me.COM_SEND("inc_zr") End Sub Private Sub btn_zoomDW_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btn_zoomDW.MouseDown Me.COM_SEND("inc_zf") End Sub 'focus Private Sub btn_focusUP_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btn_focusUP.MouseDown Me.COM_SEND("inc_fr") End Sub Private Sub btn_focusDW_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btn_focusDW.MouseDown Me.COM_SEND("inc_ff") End Sub 'Iris Private Sub btn_irisUP_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btn_irisUP.MouseDown Me.COM_SEND("inc_ir") End Sub Private Sub btn_irisDW_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btn_irisDW.MouseDown Me.COM_SEND("inc_if") End Sub 'インチング停止 Private Sub btn_ZLC_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btn_zoomUP.MouseUp, _ btn_zoomDW.MouseUp, _ btn_focusUP.MouseUp, _ btn_focusDW.MouseUp, _ btn_irisUP.MouseUp, _ btn_irisDW.MouseUp Me.COM_SEND("instop") Me.COM_SEND("read_a") End Sub '送信コマンドテキストボックス制御 Private Sub tx_comSend_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles tx_comSend.KeyPress If e.KeyChar = Chr(13) Then Me.btn_send.PerformClick() Me.tx_comSend.Text = "" End If End Sub '=========================================================== ' ' トラックバー関連 ' ' '=========================================================== Dim tb_zoomDown As Boolean = False Dim tb_focusDown As Boolean = False Dim tb_irisDown As Boolean = False Private Sub tb_iris_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_iris.MouseDown tb_irisDown = True End Sub Private Sub tb_iris_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_iris.MouseMove If Me.tb_irisDown = True Then Me.tt_val.SetToolTip(Me.tb_iris, Me.tb_iris.Value.ToString) End If End Sub Private Sub tb_iris_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_iris.MouseUp Dim val As Integer = Me.tb_iris.Value Me.disableControl() '移動完了まで停止 Me.COM_SEND("move_i," + val.ToString) Me.PosIris = val 'Me.UpdateData() Me.tb_irisDown = False Me.enableControl() Me.COM_SEND("read_a") End Sub Private Sub tb_focus_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_focus.MouseDown Me.tb_focusDown = True End Sub Private Sub tb_focus_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_focus.MouseMove If Me.tb_focusDown = True Then Me.tt_val.SetToolTip(Me.tb_focus, Me.tb_focus.Value.ToString) End If End Sub Private Sub tb_focus_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_focus.MouseUp Dim val As Integer = Me.tb_focus.Value Me.disableControl() '移動完了まで停止 Me.COM_SEND("move_f," + val.ToString) Me.PosFocus = val 'Me.UpdateData() Me.tb_focusDown = False Me.enableControl() Me.COM_SEND("read_a") End Sub Private Sub tb_zoom_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_zoom.MouseDown Me.tb_zoomDown = True End Sub Private Sub tb_zoom_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_zoom.MouseMove If Me.tb_zoomDown = True Then Me.tt_val.SetToolTip(Me.tb_zoom, Me.tb_zoom.Value.ToString) End If End Sub Private Sub tb_zoom_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles tb_zoom.MouseUp Dim val As Integer = Me.tb_zoom.Value Me.disableControl() '移動完了まで停止 Me.COM_SEND("move_z," + val.ToString) Me.PosZoom = val 'Me.UpdateData() Me.tb_zoomDown = False Me.enableControl() Me.COM_SEND("read_a") End Sub '=========================================================== ' ' テキストボックス関連 ' ' '=========================================================== Private Sub tx_zoom_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles tx_zoom.KeyPress If e.KeyChar = Chr(13) Then Me.PosZoom = Integer.Parse(Me.tx_zoom.Text) Me.COM_SEND("move_z," + Me.tx_zoom.Text) Me.COM_SEND("read_a") End If End Sub Private Sub tx_focus_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles tx_focus.KeyPress If e.KeyChar = Chr(13) Then Me.PosFocus = Integer.Parse(Me.tx_focus.Text) Me.COM_SEND("move_f," + Me.tx_focus.Text) Me.COM_SEND("read_a") End If End Sub Private Sub tx_iris_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles tx_iris.KeyPress If e.KeyChar = Chr(13) Then Me.PosIris = Integer.Parse(Me.tx_iris.Text) Me.COM_SEND("move_i," + Me.tx_iris.Text) Me.COM_SEND("read_a") End If End Sub '=========================================================== ' ' COM送受信部などの表示更新 ' Invokeで使用 ' '=========================================================== Private Sub UpdateData() Me.tx_comRes.AppendText(Me.strStatus) If Me.tx_comRes.Lines.Length > 100 Then Dim str As String = Me.tx_comRes.Text Dim Pos As Integer = Me.tx_comRes.Text.IndexOf(vbCrLf) Me.tx_comRes.Text = Me.tx_comRes.Text.Substring(Me.tx_comRes.Text.IndexOf(vbCrLf) _ + 2, Me.tx_comRes.Text.Length - ((Me.tx_comRes.Text.IndexOf(vbCrLf) + 2))) End If Me.tx_comRes.SelectionStart = Me.tx_comRes.Text.Length Me.tx_comRes.ScrollToCaret() Me.tx_zoom.Text = Me.PosZoom.ToString Me.tx_zoom.Refresh() Me.tx_focus.Text = Me.PosFocus.ToString Me.tx_focus.Refresh() Me.tx_iris.Text = Me.PosIris.ToString Me.tx_iris.Refresh() Me.tb_zoom.Value = Me.PosZoom Me.tb_focus.Value = Me.PosFocus Me.tb_iris.Value = Me.PosIris End Sub '=========================================================== ' ' 移動後のコントロールの動作回復 ' Invokeで使用 ' '=========================================================== Private Sub enableControl() Me.tb_zoom.Enabled = True Me.tb_focus.Enabled = True Me.tb_iris.Enabled = True Me.btn_zoomUP.Enabled = True Me.btn_zoomDW.Enabled = True Me.btn_focusUP.Enabled = True Me.btn_focusDW.Enabled = True Me.btn_irisUP.Enabled = True Me.btn_irisDW.Enabled = True End Sub Private Sub disableControl() Me.tb_zoom.Enabled = False Me.tb_focus.Enabled = False Me.tb_iris.Enabled = False Me.btn_zoomUP.Enabled = False Me.btn_zoomDW.Enabled = False Me.btn_focusUP.Enabled = False Me.btn_focusDW.Enabled = False Me.btn_irisUP.Enabled = False Me.btn_irisDW.Enabled = False End Sub '=========================================================== ' ' システム初期化 ' 初回通電時に必ず初期化を行ってください ' 本機内部にポテンショメータの値を記録します。 ' '=========================================================== Private Sub btn_init_Click(sender As System.Object, e As System.EventArgs) Handles btn_init.Click If MsgBox("初回起動時のポテンショメータの値登録を行いますか?" + vbCrLf + _ "※3分程度掛かります。レンズを変更しない限り必要有りません。" + vbCrLf + _ "※レンズを交換したら実行してください。", _ MsgBoxStyle.YesNo, _ "初期化の確認") = MsgBoxResult.Yes Then init_a_f = True Me.COM_SEND("init_a") rb_z100.Checked = True rb_f100.Checked = True rb_i100.Checked = True Me.COM_SEND("read_a") init_a_f = False End If End Sub '=========================================================== ' ' インチング速度設定 ' ハードウエアの仕様上focusのみ移動速度が若干遅くなります。 ' そのため、初期値でfocusのみ速度を速くしています。 ' '=========================================================== Private Sub rb_z_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rb_z100.CheckedChanged, _ rb_z200.CheckedChanged, _ rb_z255.CheckedChanged If Me.booting = True Then Return End If If CType(sender, RadioButton).Checked = True And init_a_f = False Then Select Case CType(sender, RadioButton).Name Case "rb_z100" Me.COM_SEND("s_incz,100") Exit Select Case "rb_z200" Me.COM_SEND("s_incz,200") Exit Select Case "rb_z255" Me.COM_SEND("s_incz,255") Exit Select End Select End If End Sub Private Sub rb_f_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rb_f100.CheckedChanged, _ rb_f200.CheckedChanged, _ rb_f255.CheckedChanged If Me.booting = True Then Return End If If CType(sender, RadioButton).Checked = True And init_a_f = False Then Select Case CType(sender, RadioButton).Name Case "rb_f100" Me.COM_SEND("s_incf,100") Exit Select Case "rb_f200" Me.COM_SEND("s_incf,200") Exit Select Case "rb_f255" Me.COM_SEND("s_incf,255") Exit Select End Select End If End Sub Private Sub rb_i_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles rb_i100.CheckedChanged, _ rb_i200.CheckedChanged, _ rb_i255.CheckedChanged If Me.booting = True Then Return End If If CType(sender, RadioButton).Checked = True And init_a_f = False Then Select Case CType(sender, RadioButton).Name Case "rb_i100" Me.COM_SEND("s_inci,100") Exit Select Case "rb_i200" Me.COM_SEND("s_inci,200") Exit Select Case "rb_i255" Me.COM_SEND("s_inci,255") Exit Select End Select End If End Sub '=========================================================== ' ' プリセット設定 ' ' ' '=========================================================== 'move Private Sub btn_mvP1_Click(sender As System.Object, e As System.EventArgs) Handles btn_mvP1.Click Me.COM_SEND("move_p,1") Me.COM_SEND("read_a") End Sub Private Sub btn_mvP2_Click(sender As System.Object, e As System.EventArgs) Handles btn_mvP2.Click Me.COM_SEND("move_p,2") Me.COM_SEND("read_a") End Sub Private Sub btn_mvP3_Click(sender As System.Object, e As System.EventArgs) Handles btn_mvP3.Click Me.COM_SEND("move_p,3") Me.COM_SEND("read_a") End Sub Private Sub btn_mvP4_Click(sender As System.Object, e As System.EventArgs) Handles btn_mvP4.Click Me.COM_SEND("move_p,4") Me.COM_SEND("read_a") End Sub 'set Private Sub btn_stP1_Click(sender As System.Object, e As System.EventArgs) Handles btn_stP1.Click Me.COM_SEND("s_prst,1," + tx_zoom.Text + "," + tx_focus.Text + "," + tx_iris.Text) End Sub Private Sub btn_stP2_Click(sender As System.Object, e As System.EventArgs) Handles btn_stP2.Click Me.COM_SEND("s_prst,2," + tx_zoom.Text + "," + tx_focus.Text + "," + tx_iris.Text) End Sub Private Sub btn_stP3_Click(sender As System.Object, e As System.EventArgs) Handles btn_stP3.Click Me.COM_SEND("s_prst,3," + tx_zoom.Text + "," + tx_focus.Text + "," + tx_iris.Text) End Sub Private Sub btn_stP4_Click(sender As System.Object, e As System.EventArgs) Handles btn_stP4.Click Me.COM_SEND("s_prst,4," + tx_zoom.Text + "," + tx_focus.Text + "," + tx_iris.Text) End Sub End Class