title: Getting combobox value in to another form
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/13439624/c-windows-forms-adding-items-to-listbox-in-different-class">(c# + windows forms) Adding items to listBox in different class</a>  </p>
  </blockquote>
  
  
  
  <p>I want to get the combobox value in form1 and use it at form2, because the value will return another data from the registered user</p>
  
  <pre><code>public void povoacboxcliente()
  {
      List&lt;SM.BancoDados.BD.Model.Clientes&gt; lstClientes = new List&lt;SM.BancoDados.BD.Model.Clientes&gt;();
      ClienteFlow flow = new ClienteFlow();
  
      lstClientes = flow.RetornaClientes();
  
      cboxCliente.DataSource = lstClientes;
      cboxCliente.DisplayMember = "Nome";
      cboxCliente.ValueMember = "Id";    
  }
  </code></pre>
  
  <p>Now the value member (Id) will return the sex of the member, that is on database, this part is ok, but what I want is to do the operation in another form.. Here is the code that I'm trying on form2</p>
  
  <pre><code>public void enviasexo()
      {
          EnviarComando("0238373b3be503");
          idClient = Convert.ToInt32(cboxCliente.SelectedValue); 
  
          UsuarioFlow usuarioFlow = new UsuarioFlow();
  
          string combo = cboxCliente.SelectedValue.ToString();
  
          string sexo = usuarioFlow.RetornaSexo(combo);
  
          if (sexo == "M")
          {
              Thread.Sleep(2000);
              EnviarComando("0232343b3bdc03");
              Thread.Sleep(200); //envia comando
          }
          else if (sexo == "F")
          {
              Thread.Sleep(2000);
              EnviarComando("0232353b3bdd03");
              Thread.Sleep(200);
          }
      }
  </code></pre>
  
  <p>the "cboxCliente" was used in form1</p>
  
  <p>Thanks People!</p>