title: How to display my combobox value onto my report?
body: <p>I have a form with a combobox and datetimepicker. i want the user to select a value from the combobox and choose a date and this value needs to be captured as a parameter and display on the report where the date equals chosen date and itempiececode equals chosen combobox value.</p>
  
  <p>The Pieces Involved </p>
  
  <p>The Form - Piece Code.cs
  The Report - Report6.rdlc
  The ReportViewer on the Form Piece Code.cs - reportviewer1</p>
  
  <p>If you still dont understand what my question is please click the -> <a href="http://imgur.com/D2g59w1" rel="nofollow">Picture</a></p>
  
  <p>the highlighted yellow is what i need.</p>
  
  <p>The Code i have sooo far</p>
  
  <p><strong>To fill the reportviewer</strong></p>
  
  <pre><code>private void PieceCode_Load(object sender, EventArgs e)
  {
      // TODO: This line of code loads data into the 'CorsicanaNetWeightDataSet9.CandyPieceSize' table. You can move, or remove it, as needed.
      this.CandyPieceSizeTableAdapter.Fill(this.CorsicanaNetWeightDataSet9.CandyPieceSize);
      // TODO: This line of code loads data into the 'CorsicanaNetWeightDataSet4.PieceDimensionMasterDataUpdate' table. You can move, or remove it, as needed.
      this.PieceDimensionMasterDataUpdateTableAdapter.Fill(this.CorsicanaNetWeightDataSet4.PieceDimensionMasterDataUpdate);
      // TODO: This line of code loads data into the 'corsicanaNetWeightDataSet4piece.Item_Piece' table. You can move, or remove it, as needed.
      this.item_PieceTableAdapter.Fill(this.corsicanaNetWeightDataSet4piece.Item_Piece);
      PieceReport pr = new PieceReport();
      reportViewer1.Visible = false;
      this.reportViewer1.RefreshReport();
  }
  </code></pre>
  
  <p><strong>To Fill the Combobox i used datasource and displaymemeber property</strong>
  ** I used the report wizard to generate report6**</p>
  
  <p><strong>i used GUI for most of the program so not much code to share</strong></p>
  
  <p><strong>Summary of what i need</strong>
  i need the combobox1.selectedtext set equal to a parameter on report6  and the datetimepicker.text = to another parameter so i can display it in my reportviewer?? or if there is any other workaround for the program.</p>
  
  <p><strong>I am being completely honest here and please dont close this as off topic, or dock me down because i have provided everything i have for your understanding and please help me as this is the last part of my project and i would really love to complete it before the holidays and spend time with family thanks for all your help</strong></p>
  
  <p><strong>Tried it with Code, GUI just does not cut it at times</strong></p>
  
  <pre><code>namespace CorsicanaNetWeightProgram
  {
      public partial class PieceCode : Form
      {
  
          public string constr = "Data Source=KCMJF1XTR1\\SQLEXPRESS;Initial Catalog=CorsicanaNetWeight;Integrated Security=True";
  
          public reportfiller fullpiecedetails;
  
          public piecedescription piece;
  
  
          PieceReport pr = new PieceReport(); 
          public PieceCode()
          {
              InitializeComponent();
          }
  
          private void PieceCode_Load(object sender, EventArgs e)
          {
              // TODO: This line of code loads data into the 'CorsicanaNetWeightDataSet9.CandyPieceSize' table. You can move, or remove it, as needed.
  
              // TODO: This line of code loads data into the 'corsicanaNetWeightDataSet4piece.Item_Piece' table. You can move, or remove it, as needed.
             // this.item_PieceTableAdapter.Fill(this.corsicanaNetWeightDataSet4piece.Item_Piece);
              PieceReport pr = new PieceReport();
              reportViewer1.Visible = false;
              piece = new piecedescription();
              fillpiece();
  
  
  
              this.reportViewer1.RefreshReport();
          }
  
          private void fillpiece()
          {
              try
              {
              using(MSSQL.SqlConnection connection = new MSSQL.SqlConnection(constr))
              {
                  connection.Open ();
                  using (MSSQL.SqlCommand command = new MSSQL.SqlCommand("SELECT Item + '-' + Description AS PieceDescription FROM dbo.[Piece Dimension Master Data]" ,connection))
                  {
                    MSSQL.SqlDataAdapter myadapter = new System.Data.SqlClient.SqlDataAdapter();
                          myadapter.SelectCommand = command;
                          myadapter.Fill(piece, "DataTable1");
                  comboBox1.DataSource = piece.DataTable1;
                  comboBox1.ValueMember = "PieceDescription";
                  comboBox1.DisplayMember = "PieceDescription";
  
  
          }
              }
              }
  
              catch (Exception) { /*Handle error*/ }
              }
  
  
          private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
          {          
  
          }
  
          private void button1_Click(object sender, EventArgs e)
          { 
  
  
              reportViewer1.Visible = true;
              {
                  using (MSSQL.SqlConnection connection = new MSSQL.SqlConnection(constr))
                  {
                      fullpiecedetails = new reportfiller();
                      connection.Open();
                      //MSSQL.SqlCommand command = new MSSQL.SqlCommand("SELECT * From EtimePunchDetail WHERE (EmpID = @empid) And  (Paygroup = @paygroup) And (TransDate &gt;= @fromdate) And (TransDate &lt;= @todate)", connection);
                      MSSQL.SqlCommand command = new MSSQL.SqlCommand("SELECT * FROM dbo.[Piece Dimension Master Data] WHERE Item + '-' + Description  = @piecedesc", connection);
                      {
  
                          MSSQL.SqlParameter parmEmp = new MSSQL.SqlParameter();
                          parmEmp.ParameterName = "@piecedesc";
                          parmEmp.Value = comboBox1.SelectedValue;
                          command.Parameters.Add(parmEmp);
  
  
  
                          MSSQL.SqlDataAdapter EtimePunchDetailTableAdapter = new System.Data.SqlClient.SqlDataAdapter();
                          EtimePunchDetailTableAdapter.SelectCommand = command;
                          EtimePunchDetailTableAdapter.Fill(fullpiecedetails, "DataTable1");
  
  
  
                          string exeFolder = Path.GetDirectoryName(Application.ExecutablePath);
                          string reportPath = exeFolder + @"\Report6.rdlc";
  
  
  
                          reportViewer1.LocalReport.ReportPath = reportPath;
  
                          reportViewer1.LocalReport.DataSources.Clear();
  
                          reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("reportfiller_DataTable1", fullpiecedetails));
                          reportViewer1.RefreshReport();
                          reportViewer1.Refresh();
                          reportViewer1.Visible = true;
                     }
                  }
              }
  
          }
  </code></pre>
  
  <p><strong>I am getting the following error "Value does not fall within the expected range." At this part of the code  reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("reportfiller_DataTable1", fullpiecedetails));</strong></p>