EddyW Member Licensed User Longtime User Feb 8, 2013 #1 hi All, Think i make a simple mistake but i dont see what. CboFlashmode is a spinner filled with 4 values (auto, on, off and torch) and depending on the value you select the camera will be set to that value. But in the code below its goes always to the else statement even when the value is 1 of the 3 other values. What do i wrong? Code: Sub cboFlashMode_ItemClick (Position As Int, Value As Object) Dim sWaarde As String = cboFlashMode.SelectedItem.ToUpperCase Select sWaarde Case "ON" camera1.FlashOn Case "OFF" camera1.FlashOff Case "TORCH" camera1.FlashTorch Case Else camera1.FlashAuto End Select End Sub Last edited: Feb 8, 2013
hi All, Think i make a simple mistake but i dont see what. CboFlashmode is a spinner filled with 4 values (auto, on, off and torch) and depending on the value you select the camera will be set to that value. But in the code below its goes always to the else statement even when the value is 1 of the 3 other values. What do i wrong? Code: Sub cboFlashMode_ItemClick (Position As Int, Value As Object) Dim sWaarde As String = cboFlashMode.SelectedItem.ToUpperCase Select sWaarde Case "ON" camera1.FlashOn Case "OFF" camera1.FlashOff Case "TORCH" camera1.FlashTorch Case Else camera1.FlashAuto End Select End Sub
M Mahares Expert Licensed User Longtime User Feb 8, 2013 #2 Replace this: Code: Dim sWaarde As String = cboFlashMode.SelectedItem.ToUpperCase With: Code: Dim sWaarde As String = Value.ToUpperCase Upvote 0
Replace this: Code: Dim sWaarde As String = cboFlashMode.SelectedItem.ToUpperCase With: Code: Dim sWaarde As String = Value.ToUpperCase
EddyW Member Licensed User Longtime User Feb 8, 2013 #3 i did try that before but then get the error 'Unknown type: Object' when i compile. Think i have to convert Value to string first but didnt find the command for that yet. I also tried with Sub cboFlashMode_ItemClick (Position As Int, Value As string) instead of Sub cboFlashMode_ItemClick (Position As Int, Value As Object) then value.touppercase works but dont solve my problem. Last edited: Feb 8, 2013 Upvote 0
i did try that before but then get the error 'Unknown type: Object' when i compile. Think i have to convert Value to string first but didnt find the command for that yet. I also tried with Sub cboFlashMode_ItemClick (Position As Int, Value As string) instead of Sub cboFlashMode_ItemClick (Position As Int, Value As Object) then value.touppercase works but dont solve my problem.
klaus Expert Licensed User Longtime User Feb 8, 2013 #4 How did you populate the Spinner ? You could also use: Code: Sub cboFlashMode_ItemClick (Position As Int, Value As Object) Dim sWaarde As String = cboFlashMode.SelectedItem.ToUpperCase Select Position Case 0 camera1.FlashOn Case 1 camera1.FlashOff Case 2 camera1.FlashTorch Case Else camera1.FlashAuto End Select End Sub Best regards. Upvote 0
How did you populate the Spinner ? You could also use: Code: Sub cboFlashMode_ItemClick (Position As Int, Value As Object) Dim sWaarde As String = cboFlashMode.SelectedItem.ToUpperCase Select Position Case 0 camera1.FlashOn Case 1 camera1.FlashOff Case 2 camera1.FlashTorch Case Else camera1.FlashAuto End Select End Sub Best regards.
EddyW Member Licensed User Longtime User Feb 8, 2013 #5 I polulate it with code below but the regex isnt good and i still have to look at it. I use the AdvancedCamera lib. Code: Dim lFlashModes As List = camera1.SupportedFlashMode If lFlashModes.IsInitialized = False Then cboFlashMode.Add("<Flash not supported>") cboFlashMode.Enabled = False Else ' fill spinner cboFlashMode.AddAll(Regex.Split("\,",lFlashModes)) End If Upvote 0
I polulate it with code below but the regex isnt good and i still have to look at it. I use the AdvancedCamera lib. Code: Dim lFlashModes As List = camera1.SupportedFlashMode If lFlashModes.IsInitialized = False Then cboFlashMode.Add("<Flash not supported>") cboFlashMode.Enabled = False Else ' fill spinner cboFlashMode.AddAll(Regex.Split("\,",lFlashModes)) End If
klaus Expert Licensed User Longtime User Feb 8, 2013 #6 Try to replace this line Code: cboFlashMode.AddAll(Regex.Split("\,",lFlashModes)) by Code: cboFlashMode.AddAll(lFlashModes) Best regards. Upvote 0
Try to replace this line Code: cboFlashMode.AddAll(Regex.Split("\,",lFlashModes)) by Code: cboFlashMode.AddAll(lFlashModes) Best regards.
EddyW Member Licensed User Longtime User Feb 8, 2013 #7 thanks now the select case works also Upvote 0