DataGridView Binding- VB.Net Tutorial

Binding DataGridView is very simple in .Net. Provided the knowledge of connecting to database, executing the SQL Select Queries and filling the dataset with the data fetched is necessary. While data reader also can be used for light weight read only purposes, I am explaining here with dataset. Since the coming articles in this website will refer back this article for DataBinding samples

Connect To DataBase to bind VB.Net DataGridView

We are going to use the following namespaces for using the database related objects in ADO.Net,
Import System.Data
Import System.Data.SqlClient

Next step is to get the connection to the database. Since we have already decided to use the SqlClient, we have to use SqlConnection to open a connection as follo ...

Read more here:   VB.Net DataGridView 

Sorting Data in a DataTable Tutorial

When there is a need of sorting rows in a DataTable, there is no direct support available in DataTable. There is no direct way to get the sorted records into a DataTable out of the box.  There are few ways to sort the data in the DataTable but that needs a few lines of code that I would like to discuss here. We have already discused how to sort a records in Gridview using DataView.

Sorting using DataView

Basically I like the DataView to sort the records as there is a support natively available as a property DataView.Sort. And the sorted records can be forced to a DataTable using a ToTable () method in a DataView. Not only sorting available but also there are other useful functions like filter, and distinct etc... So we can filter and sort altogether.

Sorting using a select method in DataTable

Like I said earlier there are few ways to achieve sorting in the DataTable. The select method of the DataTable als ...

Read more here:   VB DataTable Sort 

ASP.Net GridView Sorting Tutorial

GridView sorting is very easy to enable. But only few functionalities are available out of the box, so still a few things should be configured and coded. The first thing to enable sorting is AllowSorting = true. Then SortExpression has to be specified. Normally column name has to be given for the SortExpression. With this the GridView  view will be able to sort based on the SortExpression given.

GridView Sorting Vb.Net

After configuring the above when you click on the sort link in the header of the respective column, an exception will be thrown that the Sorting event is not handled. In this event we need to sort the data using a DataView. DataView has a Sort which we can use to pass the expression.

Switch Ascending and descending

Actually when a GridView is sorted in either ascending or descending order the next expected has to be opposite for the first sorting. If the first sorting i ...

Read more here:   GridView Sorting Vb.Net 

VB.Net TreeView Tutorial on Multithreading

Need of Multi threading in vb.net treeview

I am in the process of developing a windows based car pc Front-End in VB.Net. For the media playback, I was doing a PlayList editor. I don’t want to use the stock PlayList with media player as I need the custom sorting and remove PlayList item while playback.

I was in need of hierarchical control to load the files from various folders. I am a fan of  VB.Net TreeView from Classic VB days. So I thought the VB.Net TreeView is a good component for this. Now the problem is the hard disk contains around 100 GB of songs. Populating them into a tree view took around few minutes to be completed, I cant wait till then without doing anything. So I planned to run loading VB.Net TreeView in a separate thread. Immediately I have decided to go for multi threading as we can still work on other process in parallel.

.Net has excellent support for multi threading as it helps programm ...

Read more here:   VB.Net TreeView Multithreading 

ASP.Net Repeater DataBinding Tutorial

Repeater can be used for listing data. It can be used to repeat the data horizontally or vertically. And can be used to form s a HTML table and also can be used to prepare a HTML List (LI). For displaying tabular data, we can use the ASP.Net Repeater to form the HTML Table. However when the ASP.Net Repeater is used as a container for controls, It is better to design the templates to be rendered with panels (<div>) and List Items (<LI> The DataList is also works similar to Repeater. But the DataList has some additional ability to perform than ASP.Net Repeater .

When the page renders, the control loops through the rows in the data source and renders the pre configured template (either in the markup or dynamically configured) for each row. Before and after processing the data items, the ASP.Net Repeater renders the header and the footer based on the configuration of the repeater. Because it has no d ...

Read more here:   ASP.Net Repeater 

ASP. Net ListView DataBinding Tutorial

For presenting data in list form, we have several options in Asp.Net like ListView, DataList, Repeater, GridView, DropDownList, etc... Since we have a variety of controls to choose from, the control can be selected based on specific requirements. For e.g. single column with single selection the DropDownList is the perfect choice. If paging, sorting, edit is required then GridView will be the right choice.  If just need to repeat some html code, then Repeater will work out to be better. This article is focused on ListView.
 

DataBinding is quiet similar to GridView

DataBinding in ListView is almost similar to GridView. There is not much difference. There is a requirement of ItemPlaceHolder.  By default the name of that place holder is itemPlaceholder. Asp.Net allows us to custom name (id) also.

Flexibility in rendering

This ListView is one of the best controls while flexibility is taken ...

Read more here:   VB .Net ListView