Sub btnResolution_Click
Dim resolution As List = cam.GetSupportedCaptureSizes
Dim i As Int = resolution.IndexOf(cam.CaptureSize)
i = (i + 1) Mod resolution.Size
cam.CaptureSize = resolution.Get(i)
'save the selected size:
File.WriteMap(Starter.Path, "resolucion.txt", CreateMap("width": cam.CaptureSize.Width, "height": cam.CaptureSize.Height))
btnResolution.Text = resolution.Get(i)
cam.StartPreview(MyTaskIndex, VideoMode)
End Sub