Overtonp
asked on
Launching a report form a listbox using vb .net
I have an application that I'd like to add the ability to launch reports from a listbox. All it contains is a simple listbox and a button that launches another form containing the crystalreportviewer .net component. The code below is what I have done so far.
I created the list box and added an item to the list. I then created the run report button which launches a new form containing the crystal report viewer, and attempts to apply a .reportsource property based on what item in the listbox is selected.
This launches the new report form, however the report source property does not carry over, instead report simply comes up blank. Am I using the .reportsource property correctly?
I created the list box and added an item to the list. I then created the run report button which launches a new form containing the crystal report viewer, and attempts to apply a .reportsource property based on what item in the listbox is selected.
This launches the new report form, however the report source property does not carry over, instead report simply comes up blank. Am I using the .reportsource property correctly?
Public myCaller As New ReportForm 'name of the second form being launched
...
Private Sub Button1_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
If Reportbox.SelectedItem = Nothing Then
MsgBox("Please select a report to run")
Exit Sub
End If
If Reportbox.SelectedItem.Equals(repname1) Then
myCaller.CrystalReportViewer1.ReportSource = "C:\Documents and Settings\overtonp\Desktop\Samco Jobs\Crystal Reports\pow103_CUSTOM.rpt"
End If
If myForm Is Nothing Then
myForm = New Form1
End If
myForm.Show()
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER