Visual Basic .Net to Synchronize data from Remote Database Server

0 comments

Posted on 6th December 2011 by Kenneth in Visual Basic .Net

, ,

VB.NetOccasionally Connected Data (OCS) to synchronize data from remote database server. This downloads data from the server to the .sdf file. Next, make data changes in the server data grid, and then click the save button.ClickSynchronizeagain to download your changes to the client. Get full source code here


One-to-Many or Master-Detail Data entry in Visual Basic .Net

0 comments

Posted on 4th December 2011 by Kenneth in Visual Basic .Net

, ,

Visual Basic .Net sample project on how to create a One-to-Many (Master-Detail) Data entry form using the Data Sources Window and the Windows Forms designer in Visual Studio. This project connect the database Order as the master or parent then retrieve the order details as the child. Get the source code here


 

How to Connect Database in Visual Basic .Net

0 comments

Posted on 3rd December 2011 by Admin in Visual Basic .Net

,

Sample project on Visual Basic .Net in windows forms on how connect to an existing database and how to define how data is retrieved and updated using the data sources window and the dataset designer in Visual Studio. Download Project


Visual Basic .Net – Binding to Windows Forms Controls

1 comment

Posted on 7th June 2010 by Admin in Visual Basic .Net

,

The .NET Framework brings a wide variety of controls to the developer. The Windows Forms controls are found in the System.Windows.Forms namespace, and the vast majority of them support data binding. In general, data binding to a control is far from challenging. It requires that you use an in-memory data store and can usually accept either a DataTable or a DataSet.

The mechanism is very simple. Take a look at the following example, using a DataTable:

Dim adapter As New OleDbDataAdapter("Select * From Customers", _ connStr)
Dim dt As New DataTable()

' Import the query results into the DataTable
adapter.Fill(dt)

' Bind the DataTable to the DataGrid
DataGrid1.DataSource = dt

The DataSet works in almost exactly the same way:

Dim adapter As New OleDbDataAdapter("Select * From Customers", connStr)
Dim ds As New DataSet()

' Import the query results into the DataSet
adapter.Fill(ds)

' Bind a DataTable from the DataSet to the DataGrid
DataGrid1.DataSource = ds.Tables("Customers")

Notice in this example that instead of passing the entire DataSet to the DataGrid, weve chosen to bind only a single table. This is often necessary with controls for which multiple sets of tables dont make sense. The DataGrid is not one of these controls, however. It is capable of a multitable display (try it) and likes the DataSet just fine.

Combo Box and List Box Data Binding in Visual Basic 2008

1 comment

Posted on 9th May 2010 by Admin in Visual Basic .Net |Visual Basic 2008

, ,

Combo box and List box Data Binding in Visual Basic 2008

The tabbed pages of the tab control demonstrate different techniques:

  • Add ItemsThe sample retrieves an array of Process objects representing the processes currently running on the computer. TheProcessobjects are added to theItemscollection of theListBoxcontrols. TheDisplayMemberproperty of theListBoxcontrol is used to specify which property of theProcessobject is displayed in theListBoxcontrol.
  • Bind to DataTableThis tab page has code to fill aDataTablewith a list of all files in yourMy Documentsfolder, and then binds the list box to thatDataTable.
  • Bind to ArrayThis tab page has code similar to theAdd Itemspage. Instead of adding theProcessobjects one by one to theItemscollection, the whole array ofProcessobjects is used as theDataSourceof theListBoxcontrol. TheValueMemberandDisplayMemberproperties of theListBoxcontrol are used to control the display and retrieval of the items.
  • ComboBoxThis tab page has code to bind aComboBoxcontrol to aDataTableretrieved from SQL Server using the new TableAdapter and typed dataset features. This example expects that it can find the Northwind sample database in SQL Server on the local computer. The page has controls to enable you to specify some of the layout properties that affect the behavior of theComboBoxcontrol.

    Download Sample Project
    Password to extract: combobox1001