Automaticly pick up camera

Hello

I’m using that code to pick camera

private void button1_Click(object sender, EventArgs e)

{

  // properly discard the previous camera control, if one is already selected

  if (imageViewerControl != null)

  {

    imageViewerControl.Disconnect();

    imageViewerControl.Close();

    imageViewerControl.Dispose();

    imageViewerControl = null;

  }

  ItemPickerForm picker = new ItemPickerForm();

  picker.TopMost=true;

  picker.KindFilter = Kind.Camera;

  picker.Init(Configuration.Instance.GetItems());

  if (picker.ShowDialog() == DialogResult.OK)

  {

    selectedItem = picker.SelectedItem;

    label2.Text = [selectedItem.Name](https://selectedItem.Name);

    try

    {

      // image viewer control settings

      imageViewerControl = ClientControl.Instance.GenerateImageViewerControl();

      imageViewerControl.Dock = DockStyle.Fill;

      panel1.Controls.Clear();

      panel1.Controls.Add(imageViewerControl);

      imageViewerControl.CameraFQID = selectedItem.FQID;

      imageViewerControl.EnableDigitalZoom = true;

      imageViewerControl.EnableVisibleHeader = false;

      imageViewerControl.Initialize();

      imageViewerControl.Connect();

    }

    catch (Exception ex)

now i know that i want to view exacly 1 camera and put in program c# automaticly pick up camera name “Camera 1” for example

it is posible to do that?

You want to pick up the camera in code, not using the item-picker. There is an example of this in the Camera Stream Resolution sample (FindCamera method).

http://doc.developer.milestonesys.com/html/index.html?base=samples/camerastreamresolution.html&tree=tree_2.html