How to pass value from textbox as a parameter to the SSRS report
Something as simple as this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnRunReport_Click(object sender, EventArgs e)
{
Int32 year;
if (Int32.TryParse(textBox1.Text, out year))
{
Form2 form2 = new Form2(year);
form2.ShowDialog();
}
}
}
}
//Form2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
private Int32 Year;
public Form2(Int32 year)
{
InitializeComponent();
this.Year = year;
}
}
}
John Grove - DSS, Senior Software Engineer
February 18th, 2011 6:45pm