All Events getting morethan one time
i've created one report using crystal report. in that i'm passing the dynamic parameter like this
If pVal.ItemUID = "Print" Then
oForm = SBO_Application.Forms.ActiveForm
oEdit = oForm.Items.Item("txtwkctr").Specific
patt = oEdit.Value
If patt "" Then
con1 = con1 & " and Code >='" & patt & "'"
oedit1 = oForm.Items.Item("txtto").Specific
patt1 = oedit1.Value
If patt1 "" Then
con1 = con1 & " and Code <='" & patt1 & "'"
wrkcenter = "SELECT * FROM dbo.@TI_WRKCTR where 1=1 " & con1
after that i designed crystal report in a form and loading that windows form. then i have written follwing code in form load
Public Class MasterWork
Private Sub MasterWork_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'DataSet1.__TI_WRKCTR' table. You can move, or remove it, as needed.
Dim rpt As New WorkCenter()
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand()
Dim myDA As New SqlDataAdapter()
Dim myDS As New DataSet1()
Dim tes As New Tespamfg 'The DataSet you created.
myConnection = New SqlConnection("Server=" & servername & ";User Id=" & username & ";Password = ******;DataBase=" & databasename & ";")
MyCommand.Connection = myConnection
MyCommand.CommandText = wrkcenter
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
CrystalReportViewer1.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
when i click on "Print" Button the form is loading with proper report. now i'm closing dialog(form).
next time next event geting twice. next time event getting thrice ..... when i close dialog its adding the event another time.