2017-06-13 123 views
0
Try 
    For Each Camera As WebCameraId In frmMain.wcc.GetVideoCaptureDevices 

     If cbCamera.SelectedItem = Camera.GetHashCode Then 
      txtCamName.Text = Camera.Name 
     End If 
    Next 

Catch ex As Exception 
    MsgBox(ex.Message) 
End Try 

如何將值返回給webcameraId?返回值返回WebCameraId

+0

你試圖返回哪個變量?並花時間參加[參觀]並閱讀[問] – Mederic

回答

0

該命令解決了這個問題

Try 
     Dim CamId As New List(Of WebCameraId)(frmMain.wcc.GetVideoCaptureDevices()) 
     For Each Camera As WebCameraId In frmMain.wcc.GetVideoCaptureDevices 

      If cbCamera.SelectedItem = Camera.GetHashCode Then 
       txtCamName.Text = Camera.Name 
       txtCamIndex.Text = CamId.IndexOf(Camera) 
       frmMain.wcc.StartCapture(CamId(txtCamIndex.Text)) 
      End If 
     Next 

    Catch ex As Exception 
     MsgBox("Error 0x03102090Cam" & ex.Message) 
    End Try 

返回相機的價值爲CAMID。我現在可以使用SQL數據庫中的StartCapture。