Tag Archives: WinForm

Applying Report Viewer 2010 Control With RDLC file In Visual Studio 2010 Express Edition (C#)

I use Report Viewer 2010 or version 10 instead of 8 or 9, so that more updated of Report Definition file can be viewed.

First of all, please download Report Viewer 2010 control (Report Viewer Version 10) from this link http://www.microsoft.com/en-us/download/details.aspx?id=6442 and install it since VS 2010 Express was shipped with Report Viewer Version 8 and/or 9.

After you install it, that component will be registered on C:\Windows\assembly folder. If you browse to C:\Windows\assembly using Windows Explorer then you will see custom shell extension view.

Please take note that even though we already install Report Viewer 2010 but VS 2010 Express Edition still not recognized version 10. It still has version 9. We need to copy required library files and add them as project reference.

However, you can not just copy those Assembly’s library with just right click. We need to copy installed 3 library files comes from Report Viewer 10 installation which are Microsoft.ReportViewer.Common,
Microsoft.ReportViewer.ProcessingObjectModel and Microsoft.ReportViewer.Winforms to our own Folder as usual file system.
Continue reading

WinForm Model View Controller Using VB.Net WebBrowser Control


A lot of example of Model View Controller Pattern (MVC) are related to Web application but we can make it on Winform.

As a brief, Model View Controller is a way to separate between bussiness logic and presentation. Each layers are independent from others or loose coupling.
Model layer is a business logic. It can be database access or any business rules. View layer is a application layout design. Controller is a connector between model and view and act as main program at MVC.
Users see a controller in the application. MVC is useful for developing medium to large product with several programmers. Those programmers can work simultanously. They can work independently as much as possible.
I already have simple example of web MVC using php at Web Model View Controller (MVC) Concept with PHP example

In this example I use VB.Net Winform Application and using WebBrowser Control as a user interface. I have earlier post that explain on Using VB.Net WebBrowser Control as WinForm user interface.
I create 3 projects in the solution to represents Model View Controller them self.
The three projects are ClassLibDatabaseMVC.vbproj as Database/Model Layer, ClassLibPresentation.vbproj as View Layer and WinFormBrowserMVC as Controller Layer.

Continue reading

Fill DataGridView and cancel process using DataAdapter and BackgroundWorker


Filling data to DataGridView with SqlDataAdapter is a common task but to cancel it in the middle of fill process need a tricky way. Especially when SqlDataAdapter returning large DataSet then no progress status informed to user since SqlDataAdapter need time to fetch DataSet. Also this project does not need to have button like “More records” to fetch more dataset. We can retrieve as much records you like and cancel it any time.


We need to show records immediately and user can cancel the retrieval process whenever they like. The basic idea is using int recordcount = SqlDataAdapter.Fill(int startrow, int maxrecords, DataTable dt) method at BackgroundWorker.DoWork event. That Fill method is similar to paging in web page. BackgroundWorker execute SqlDataAdapter.Fill in loop until it has no more record to fetch and we can cancel the process before or after SqlDataAdapter.Fill. Continue reading

BackgroundWorker Intro Part 1 – Work with ProgressBar

Winform application usually need asynchronous process. Progress status of this process commonly showed with progressbar control.
As a default Thread class accomplish the asynchronous process but .Net has built in BackgroundWorker component to do async easily.

BackgroundWorker component/class has events which are DoWork, ProgressChanged, RunWorkerCompleted.
DoWork handles main async job. ProgressChanged handles displaying async progress info to user. RunWorkerCompleted handles event when async process is completed.

This BackgroundWorker has Cancel ability, so that user can cancel asnyc in the middle of its process. Continue reading

Using VB .Net WebBrowser Control To Build WinForm User Interface

Most application use textbox, frame, picturebox, label, listbox, combobox controls etc to make a user interface.
On the other hand WebBrowser Control commonly used to browse online website. However WebBrowser Control can be used to build rich user interface. We can develop any project i.e database, files, streaming operation.
The requirements are only knowledge of html tags, methods and behaviour of WebBrowser Control itself. In my opinion, it is easier to develop using webbrowser’s html rather than label, textbox, picturebox controls etc

Key points to develop with webbrowser on VB .Net 2010 are:
Continue reading