Wednesday, March 14, 2012

Web Browser Sample Code on Visual Basic 2010

This code illustrate on how to use the web browser control in Visual Basic 2010. It uses the following events and command:
WebBrowser1.IsBusy, WebBrowser1.Document.Body.InnerHtml, WebBrowser1.Navigate, WebBrowser1.CanGoBack, WebBrowser1.CanGoForward, WebBrowser1.IsBusy, WebBrowser1.Refresh
Download Project

Screenshot

Saturday, March 10, 2012

How to call crystal report in Visual Basic 2010 with Record Selection Formula

Visual Basic Sample code on how to call and filter crystal report in Visual Basic 2010 using the Record Selection Formula. Download Project


Visual Basic Source Code
 
Imports CrystalDecisions.CrystalReports.Engine
Imports System.IO

Public Class Form1


    Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim cryReport As New ReportDocument
        RepLocation = Path.GetFullPath( _
            Path.Combine(Application.StartupPath, "..\..")) & _
            "\CrystalReport1.rpt"

        cryReport.Load(RepLocation)
        If TextBox1.Text <> "" Then
            cryReport.RecordSelectionFormula = "{Customer.CustomerID} = " & TextBox1.Text
        End If
        CrystalReportViewer1.ReportSource = cryReport
        CrystalReportViewer1.Refresh()
    End Sub
End Class

 
Powered by Blogger