# S1 / D3 in IT or similar
# 1-2 years experience in Visual Studio .NET environment, for both desktop and web application, preferrably VS2005 or 2008
# Windows Mobile (wm 05 or wm 06) programming experience is a plus
# Have a good knowledge of web service
# Familiar with wireless networking technology
# Experience with MSSQL server environment is a plus
# Familiar with offline data processing
# Good in C# or Visual Basic
Apa job descnya?
Job desc untuk setiap orang KT itu gampang. Anda dibayar untuk:
- Belajar dan belajar untuk diri Anda sendiri
- Membantu sesama rekan kerja improve, membantu customers dan clients untuk sukses
Selebihnya, anggaplah Anda di KT mengerjakan hobi Anda.
Ada syarat lagi supaya saya bisa menjadi bagian dari KT?
- Jujur dan berintegritas tinggi
- Senang belajar hal baru
- Senang menolong orang lain
- Mampu berkomunikasi dengan baik; bahasa Inggris diutamakan
- Mampu bekerja secara mendetail dan hati-hati
Bagaimana saya bisa mengirim lamaran?
Harap CV Anda dibersihkan dari hal-hal yang tidak perlu. Misalnya, kita tidak perlu tahu bahwa Anda seorang laki/perempuan, kita tidak perlu tahu ras, agama, tanggal lahir apalagi hobi Anda. Kita juga tidak perlu melihat foto Anda. Kita juga tidak perlu tahu Anda sekolah SD di mana, SMP di mana. Dan bila Anda pernah bekerja yg tidak relevan dengan posisi yang Anda lamar, tidak perlu ditulis. Bila Anda punya skill yang tidak relevan, juga tidak perlu ditulis.
Bila sudah siap kirim lamaran Anda ke hrd@kiranatama.com, dengan judul email '.NET DEVELOPER' Atau ke PO BOX 1183 Kode Pos 40011 Bandung.
Friday, December 26, 2008
Monday, December 22, 2008
OleDbConnection - Using sql statement
Option Strict On
Imports System.Data
Imports System.Data.OleDb
Public Module UsingStatement
Public Sub Main()
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NorthWind.mdb")
Dim cmd As New OleDbCommand
Dim dr As OleDbDataReader
Using conn
conn.Open
cmd.CommandText = "Select * From Customers"
cmd.CommandType = CommandType.Text
cmd.Connection = conn
dr = cmd.ExecuteReader()
If dr.HasRows Then
Do While dr.Read()
' Get first and last name of customer
Console.WriteLine(CStr(dr.Item(1)) & " " & CStr(dr.Item(2)))
Loop
Else
Console.WriteLine("The table has no rows.")
End If
End Using
End Sub
End Module
Imports System.Data
Imports System.Data.OleDb
Public Module UsingStatement
Public Sub Main()
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NorthWind.mdb")
Dim cmd As New OleDbCommand
Dim dr As OleDbDataReader
Using conn
conn.Open
cmd.CommandText = "Select * From Customers"
cmd.CommandType = CommandType.Text
cmd.Connection = conn
dr = cmd.ExecuteReader()
If dr.HasRows Then
Do While dr.Read()
' Get first and last name of customer
Console.WriteLine(CStr(dr.Item(1)) & " " & CStr(dr.Item(2)))
Loop
Else
Console.WriteLine("The table has no rows.")
End If
End Using
End Sub
End Module
SqlConnection - Connection string for SqlConnection
Module Module1
Dim sConnection As String = "Password=password;Persist Security Info=True;User ID=sa;Initial Catalog=CD;Data Source=(local)"
Sub Main()
Dim objConn As New System.Data.SqlClient.SqlConnection(sConnection)
Try
objConn.Open()
Catch myException As System.Exception
Console.WriteLine(myException.Message)
End Try
Console.ReadLine()
End Sub
End Module
Dim sConnection As String = "Password=password;Persist Security Info=True;User ID=sa;Initial Catalog=CD;Data Source=(local)"
Sub Main()
Dim objConn As New System.Data.SqlClient.SqlConnection(sConnection)
Try
objConn.Open()
Catch myException As System.Exception
Console.WriteLine(myException.Message)
End Try
Console.ReadLine()
End Sub
End Module
Tuesday, December 16, 2008
JOB VACANCY PROGRAMMER AT QDC TECHNOLOGIES, PT
Company Description
PT. Qdc Technologies is The Fast Growing Company specialized in telecommunication infrastructure development and construction, invites you to be a part of our team for the following immediate opening:
PROGRAMMER
Job Responsibilities:
* Application development
* Web integration
* Website webmaster
* Intranet webmaster
Job Requirements:
· Having educational background minimum D3
· Having minimum experience in the same position min. 2 year
· Mastering Microsoft Visual Basic 6, Visual Studio.net, MySQL, Access, database (Store Procedure)
· Having Computer skill in PC Software, hardware, network trouble solving, Linux System Administration, VB, PHP, Java
· Good in Bahasa Indonesia & basic English
· Must be willing to learn new technologies
If you meet the criteria above, please send your application letter with detail resume to: hr@qdc.co.id
If you want to know more about our company profile, please visit our website at:
www.qdc.co.id
Career Level Middle
Qualification Diploma
Yr(s) Exp 2 year(s)
Job Category Information Technology (I.T.) - Application Specialist, Information Technology (I.T.) - Programming, Information Technology (I.T.) - Software Design & Engineering
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Full Time, Permanent, Contract
Quick Apply
PT. Qdc Technologies is The Fast Growing Company specialized in telecommunication infrastructure development and construction, invites you to be a part of our team for the following immediate opening:
PROGRAMMER
Job Responsibilities:
* Application development
* Web integration
* Website webmaster
* Intranet webmaster
Job Requirements:
· Having educational background minimum D3
· Having minimum experience in the same position min. 2 year
· Mastering Microsoft Visual Basic 6, Visual Studio.net, MySQL, Access, database (Store Procedure)
· Having Computer skill in PC Software, hardware, network trouble solving, Linux System Administration, VB, PHP, Java
· Good in Bahasa Indonesia & basic English
· Must be willing to learn new technologies
If you meet the criteria above, please send your application letter with detail resume to: hr@qdc.co.id
If you want to know more about our company profile, please visit our website at:
www.qdc.co.id
Career Level Middle
Qualification Diploma
Yr(s) Exp 2 year(s)
Job Category Information Technology (I.T.) - Application Specialist, Information Technology (I.T.) - Programming, Information Technology (I.T.) - Software Design & Engineering
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Full Time, Permanent, Contract
Quick Apply
JOB VACANCY DATACOM SOLUSINDO, PT
Company Description
Datacom Solusindo as the pioneer in Telephone Billing System with thousands of customers in local & global market, looking for talented & motivated individuals who love to be challenged and ready to grow together as a team and grab the opportunity within the company as a :
Senior Programmer Analyst Post Date: 15 Dec 08
Qualification:
* Male or Female
* Age between 25 – 35 years old
* Min Education: Bachelor Degree
* At least 2 year experience in the same position
* Experienced in using UML
* Experienced in Programmer
* Experienced in leading Development Project
* Good attitude performance and charming
* Able to work independently and/or as a part of team
* Fluent in English both oral and written is advantage
* A non smoking is a must
VB Programmer
Qualification:
* Male or Female
* Age between 23 – 32 years old
* Min Education: Bachelor Degree
* At least 2 year experience in the same position
* Experienced in VB & VB.Net
* Experienced in RDBMS (MYSQL/MSSQL)
* Experienced in WEB Programming
* Good attitude performance and charming
* Able to work independently and/or as a part of team
* Fluent in English both oral and written is advantage
* A non smoking is a must
Please send your Application, CV, Portfolio and Photograph to: recruit@datacomsolusindo.co.id
or
PT Datacom Solusindo Komplek Green Garden Blok Z2 / 64-65
Career Level Middle
Qualification Degree
Yr(s) Exp 2 year(s)
Job Category Information Technology (I.T.) - Application Specialist, Information Technology (I.T.) - Programming, Information Technology (I.T.) - Software Design & Engineering
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Permanent
Datacom Solusindo as the pioneer in Telephone Billing System with thousands of customers in local & global market, looking for talented & motivated individuals who love to be challenged and ready to grow together as a team and grab the opportunity within the company as a :
Senior Programmer Analyst Post Date: 15 Dec 08
Qualification:
* Male or Female
* Age between 25 – 35 years old
* Min Education: Bachelor Degree
* At least 2 year experience in the same position
* Experienced in using UML
* Experienced in Programmer
* Experienced in leading Development Project
* Good attitude performance and charming
* Able to work independently and/or as a part of team
* Fluent in English both oral and written is advantage
* A non smoking is a must
VB Programmer
Qualification:
* Male or Female
* Age between 23 – 32 years old
* Min Education: Bachelor Degree
* At least 2 year experience in the same position
* Experienced in VB & VB.Net
* Experienced in RDBMS (MYSQL/MSSQL)
* Experienced in WEB Programming
* Good attitude performance and charming
* Able to work independently and/or as a part of team
* Fluent in English both oral and written is advantage
* A non smoking is a must
Please send your Application, CV, Portfolio and Photograph to: recruit@datacomsolusindo.co.id
or
PT Datacom Solusindo Komplek Green Garden Blok Z2 / 64-65
Career Level Middle
Qualification Degree
Yr(s) Exp 2 year(s)
Job Category Information Technology (I.T.) - Application Specialist, Information Technology (I.T.) - Programming, Information Technology (I.T.) - Software Design & Engineering
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Permanent
JOB VACANCY IT PROGRAMMER AT MITRA INTEGRASI KOMPUTINDO, PT
Qualifications:
* Familiar or experience in Web-based application development (with HTML/Javascript)
* Familiar or experience in J2EE technology such as JSP, Servlet
* Familiar or experience with SQL statement in MS SQL Server or Oracle
Please send the CV to hrd@mik.co.id
or send to
PT. Mitra Integrasi Komputindo
Taman Perkantoran Kuningan
Graha MIK, 7th floor
Jl. Setiabudi Selatan Kav. 16-17
Jakarta Selatan 12920
Career Level Entry Level
Qualification Diploma
Yr(s) Exp N/A
Job Category Information Technology (I.T.) - Application Specialist, Information Technology (I.T.) - Programming, Information Technology (I.T.) - SAP / Oracle
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Full Time, Permanent
* Familiar or experience in Web-based application development (with HTML/Javascript)
* Familiar or experience in J2EE technology such as JSP, Servlet
* Familiar or experience with SQL statement in MS SQL Server or Oracle
Please send the CV to hrd@mik.co.id
or send to
PT. Mitra Integrasi Komputindo
Taman Perkantoran Kuningan
Graha MIK, 7th floor
Jl. Setiabudi Selatan Kav. 16-17
Jakarta Selatan 12920
Career Level Entry Level
Qualification Diploma
Yr(s) Exp N/A
Job Category Information Technology (I.T.) - Application Specialist, Information Technology (I.T.) - Programming, Information Technology (I.T.) - SAP / Oracle
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Full Time, Permanent
JOB VACANCY IT PROGRAMMER AT PASIFIK SATELIT NUSANTARA, PT
Company Description
URGENTLY REQUIRED
PT. Pasifik Satelit Nusantara is Indonesia’s first private satellite telecommunications company and one of the leading satellite companies in Asia Pacific region. Headquartered in Indonesia, the Company is focused on becoming a fully integrated provider of satellite based telecommunication products and services in the region.
Due to the Company’s rapidly expanding business; we invite young, energetic and talented person to join our professional team as :
IT Programer Post Date: 16 Dec 08
Jobdes:
1. Pengalaman membuat form dan report, diutamakan developer form & report Oracle
2. Dapat menganalisis ERD
3. Menguasai database, diutamakan oracle
4. Sudah biasa menggunakan query SQL
5. Memahami alur value chain perusahaan, lebih disukai
Kualifikasi:
1. Female
2. Pendidikan S-1
3. Jurusan Teknik Informatika atau Sistem Informatika
4. Usia 23 - 25 tahun
5. Pengalaman Kerja 0 - 1 thn
6. Untuk di tempatkan di Cikarang
Kirimkan Lamaran Lengkap, CV dan Pas Foto Ke: recruitment@psn.co.id
Please put the position’s code as the SUBJECT of your e-mail.
Only short listed candidate will be notified.
Career Level Entry Level
Qualification Degree
Yr(s) Exp N/A
Job Category Information Technology (I.T.) - Programming, Information Technology (I.T.) - SAP / Oracle, Information Technology (I.T.) - IT Technical Support
Job Location (Any)
Salary Negotiable
Job Type Full Time, Permanent
URGENTLY REQUIRED
PT. Pasifik Satelit Nusantara is Indonesia’s first private satellite telecommunications company and one of the leading satellite companies in Asia Pacific region. Headquartered in Indonesia, the Company is focused on becoming a fully integrated provider of satellite based telecommunication products and services in the region.
Due to the Company’s rapidly expanding business; we invite young, energetic and talented person to join our professional team as :
IT Programer Post Date: 16 Dec 08
Jobdes:
1. Pengalaman membuat form dan report, diutamakan developer form & report Oracle
2. Dapat menganalisis ERD
3. Menguasai database, diutamakan oracle
4. Sudah biasa menggunakan query SQL
5. Memahami alur value chain perusahaan, lebih disukai
Kualifikasi:
1. Female
2. Pendidikan S-1
3. Jurusan Teknik Informatika atau Sistem Informatika
4. Usia 23 - 25 tahun
5. Pengalaman Kerja 0 - 1 thn
6. Untuk di tempatkan di Cikarang
Kirimkan Lamaran Lengkap, CV dan Pas Foto Ke: recruitment@psn.co.id
Please put the position’s code as the SUBJECT of your e-mail.
Only short listed candidate will be notified.
Career Level Entry Level
Qualification Degree
Yr(s) Exp N/A
Job Category Information Technology (I.T.) - Programming, Information Technology (I.T.) - SAP / Oracle, Information Technology (I.T.) - IT Technical Support
Job Location (Any)
Salary Negotiable
Job Type Full Time, Permanent
Job Vacancy for GAC SAMUDERA LOGISTICS, PT
GAC is a leading multinational company that provides high-quality Shipping, Logistics, Solutions and Marine services in more than 50 countries in 200 offices around the globe. GAC currently employs over 7000 people. For more details visit www.gacworld.com.
GAC Group I.T. team is expanding and looking for Programmer / Analyst with minimum 1 year experience in one of the following areas.
1. ASP.Net (C# is preferred) + Sybase (or) MS SQL Server
2. Power Builder + Sybase (or) MS SQL Server
I.T. Programmer
The job requires to be based at PT. GAC Samudera Logistics our state-of-the-art facility at Lippo Cikarang. You will be developing in-house software’s for GAC business areas and will be involved in support & implementation of the software for GAC Group of companies world-wide. It might required little travel overseas. Oral & written communication in English is required.
Please send your detailed resume in English in the format described below.
1. Current Contact details, Qualification, Personal details
2. Technical Skills
3. Employment History
4. Current Salary & Expected Salary
5. Project wise details
- Project Title / Duration
- Software / Hardware platform
- Brief description of the project and your role in the project
Only serious candidates willing to work at Lippo Cikarang need apply. GAC provides transportation from Jakarta city. Candidates willing to relocate around Lippo Cikarang are more welcome. Salary is not a constraint for the right candidate. Only short-listed candidates will be called for an interview.
Interested applicants are invited to email your resume to HR Manager
hrgsl@cbn.net.id cc: Tutik.budiyanti@gacworld.com
Last date for submitting application: December 31st, 2008
Career Level Middle
Qualification Degree
Yr(s) Exp 1 year(s)
Job Category Information Technology (I.T.) - Programming, Information Technology (I.T.) - Software Design & Engineering, Information Technology (I.T.) - Others
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Full Time, Permanent
GAC Group I.T. team is expanding and looking for Programmer / Analyst with minimum 1 year experience in one of the following areas.
1. ASP.Net (C# is preferred) + Sybase (or) MS SQL Server
2. Power Builder + Sybase (or) MS SQL Server
I.T. Programmer
The job requires to be based at PT. GAC Samudera Logistics our state-of-the-art facility at Lippo Cikarang. You will be developing in-house software’s for GAC business areas and will be involved in support & implementation of the software for GAC Group of companies world-wide. It might required little travel overseas. Oral & written communication in English is required.
Please send your detailed resume in English in the format described below.
1. Current Contact details, Qualification, Personal details
2. Technical Skills
3. Employment History
4. Current Salary & Expected Salary
5. Project wise details
- Project Title / Duration
- Software / Hardware platform
- Brief description of the project and your role in the project
Only serious candidates willing to work at Lippo Cikarang need apply. GAC provides transportation from Jakarta city. Candidates willing to relocate around Lippo Cikarang are more welcome. Salary is not a constraint for the right candidate. Only short-listed candidates will be called for an interview.
Interested applicants are invited to email your resume to HR Manager
hrgsl@cbn.net.id cc: Tutik.budiyanti@gacworld.com
Last date for submitting application: December 31st, 2008
Career Level Middle
Qualification Degree
Yr(s) Exp 1 year(s)
Job Category Information Technology (I.T.) - Programming, Information Technology (I.T.) - Software Design & Engineering, Information Technology (I.T.) - Others
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Full Time, Permanent
VB.NET Programmer job in Jakarta
SANGHIANG PERKASA, PT (KALBE NUTRITIONALS)
Essential Responsibilities: To develop state of art software application which align with the requirement and to ensure that the deliveries are in high quality level.
Education: University Degree
Qualification: Degree in Computer Science.
Experience:
* Familiar with VB.NET programming using Visual Studio 2005.
* Familiar with SQL Server 2000/2005.
* Knowledge in state of art software development technology are advantageous.
* Experiences with .NET Framework 2.0, Microsoft Source Safe, and other ORM tools are advantageous.
* Experiences with ETL tools and Reporting tools are advantageous.
Personal Skills:
* Ability to deliver high quality work
* Ability to work in teams
* Eager to learn with minimum supervision
Please send your application and full resume to:
HRD – KALBE Nutritionals
Gedung Graha Kirana Lt.5 Suite 501
Jl. Yos Sudarso Kav. 88 Sunter
Jakarta Utara 14350
Or e-mail: recruitment@kalbenutritionals.com
(Put the position code on the envelope or email subject.)
Qualification Degree
Yr(s) Exp N/A
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Full Time, Permanent
Essential Responsibilities: To develop state of art software application which align with the requirement and to ensure that the deliveries are in high quality level.
Education: University Degree
Qualification: Degree in Computer Science.
Experience:
* Familiar with VB.NET programming using Visual Studio 2005.
* Familiar with SQL Server 2000/2005.
* Knowledge in state of art software development technology are advantageous.
* Experiences with .NET Framework 2.0, Microsoft Source Safe, and other ORM tools are advantageous.
* Experiences with ETL tools and Reporting tools are advantageous.
Personal Skills:
* Ability to deliver high quality work
* Ability to work in teams
* Eager to learn with minimum supervision
Please send your application and full resume to:
HRD – KALBE Nutritionals
Gedung Graha Kirana Lt.5 Suite 501
Jl. Yos Sudarso Kav. 88 Sunter
Jakarta Utara 14350
Or e-mail: recruitment@kalbenutritionals.com
(Put the position code on the envelope or email subject.)
Qualification Degree
Yr(s) Exp N/A
Job Location DKI Jakarta - Jakarta
Salary Negotiable
Job Type Full Time, Permanent
Friday, December 12, 2008
Creating Multimedia Applications
You can create various multimedia applications in VB that could play audio CD, audiofiles, VCD , video files and more.
To be able to play multimedia files or multimedia devices, you have to insert Microsoft Multimedia Control into your VB applications that you are going to create. However, Microsoft Multimedia Control is not normally included in the startup toolbox, therefore you need to add the MM control by pressing Ctrl+T and select it from the components dialog box that is displayed.
1. Creating a CD player

The Code
Private Sub Form_Load()
'To position the page at the center
Left = (Screen.Width - Width) \ 2
Top = (Screen.Height - Height) \ 2
'Initialize the CD
myCD.Command = "Open"
End Sub
Private Sub myCD_StatusUpdate()
'Update the track number
trackNum.Caption = myCD.Track
End Sub
Private Sub Next_Click()
myCD.Command = "Next"
End Sub
Private Sub Play_Click()
myCD.Command = "Play"
End Sub
Private Sub Previous_Click()
myCD.Command = "Prev"
End Sub
Private Sub Stop_Click()
myCD.Command = "Stop"
End Sub
To be able to play multimedia files or multimedia devices, you have to insert Microsoft Multimedia Control into your VB applications that you are going to create. However, Microsoft Multimedia Control is not normally included in the startup toolbox, therefore you need to add the MM control by pressing Ctrl+T and select it from the components dialog box that is displayed.
1. Creating a CD player

The Code
Private Sub Form_Load()
'To position the page at the center
Left = (Screen.Width - Width) \ 2
Top = (Screen.Height - Height) \ 2
'Initialize the CD
myCD.Command = "Open"
End Sub
Private Sub myCD_StatusUpdate()
'Update the track number
trackNum.Caption = myCD.Track
End Sub
Private Sub Next_Click()
myCD.Command = "Next"
End Sub
Private Sub Play_Click()
myCD.Command = "Play"
End Sub
Private Sub Previous_Click()
myCD.Command = "Prev"
End Sub
Private Sub Stop_Click()
myCD.Command = "Stop"
End Sub
Thursday, December 11, 2008
SqlConnection - Connection string for SqlConnection
Module Module1
Dim sConnection As String = "Password=password;Persist Security Info=True;User ID=sa;Initial Catalog=CD;Data Source=(local)"
Sub Main()
Dim objConn As New System.Data.SqlClient.SqlConnection(sConnection)
Try
objConn.Open()
Catch myException As System.Exception
Console.WriteLine(myException.Message)
End Try
Console.ReadLine()
End Sub
End Module
Dim sConnection As String = "Password=password;Persist Security Info=True;User ID=sa;Initial Catalog=CD;Data Source=(local)"
Sub Main()
Dim objConn As New System.Data.SqlClient.SqlConnection(sConnection)
Try
objConn.Open()
Catch myException As System.Exception
Console.WriteLine(myException.Message)
End Try
Console.ReadLine()
End Sub
End Module
OleDbConnection - Using sql statement
Option Strict On
Imports System.Data
Imports System.Data.OleDb
Public Module UsingStatement
Public Sub Main()
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NorthWind.mdb")
Dim cmd As New OleDbCommand
Dim dr As OleDbDataReader
Using conn
conn.Open
cmd.CommandText = "Select * From Customers"
cmd.CommandType = CommandType.Text
cmd.Connection = conn
dr = cmd.ExecuteReader()
If dr.HasRows Then
Do While dr.Read()
' Get first and last name of customer
Console.WriteLine(CStr(dr.Item(1)) & " " & CStr(dr.Item(2)))
Loop
Else
Console.WriteLine("The table has no rows.")
End If
End Using
End Sub
End Module
Imports System.Data
Imports System.Data.OleDb
Public Module UsingStatement
Public Sub Main()
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=NorthWind.mdb")
Dim cmd As New OleDbCommand
Dim dr As OleDbDataReader
Using conn
conn.Open
cmd.CommandText = "Select * From Customers"
cmd.CommandType = CommandType.Text
cmd.Connection = conn
dr = cmd.ExecuteReader()
If dr.HasRows Then
Do While dr.Read()
' Get first and last name of customer
Console.WriteLine(CStr(dr.Item(1)) & " " & CStr(dr.Item(2)))
Loop
Else
Console.WriteLine("The table has no rows.")
End If
End Using
End Sub
End Module
Create OleDbConnection to Access database
Imports System.Data
Module Test
Sub Main()
Dim sConnectionString, sSQL As String
'SQL Connection String
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\yourdatabase.mdb"
sSQL = "SELECT Title FROM yourTable"
Dim conn As New System.Data.OleDb.OleDbConnection(sConnectionString)
Dim cmd As New System.Data.OleDb.OleDbCommand(sSQL, conn)
Dim dr As System.Data.OleDb.OleDbDataReader
conn.Open()
dr = cmd.ExecuteReader()
Do While dr.Read()
System.Console.WriteLine(dr.Item("Title"))
Loop
dr.Close()
conn.Close()
End Sub
End Module
Module Test
Sub Main()
Dim sConnectionString, sSQL As String
'SQL Connection String
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\yourdatabase.mdb"
sSQL = "SELECT Title FROM yourTable"
Dim conn As New System.Data.OleDb.OleDbConnection(sConnectionString)
Dim cmd As New System.Data.OleDb.OleDbCommand(sSQL, conn)
Dim dr As System.Data.OleDb.OleDbDataReader
conn.Open()
dr = cmd.ExecuteReader()
Do While dr.Read()
System.Console.WriteLine(dr.Item("Title"))
Loop
dr.Close()
conn.Close()
End Sub
End Module
Create OleDbConnection to Sql server
Imports System.Data
Module Test
Sub Main()
Dim sConnectionString, sSQL As String
'SQL Connection String
sConnectionString = "Provider=SQLOLEDB.1;User ID=sa;Initial Catalog=YourDataBase;Data Source=(local)"
sSQL = "SELECT Title FROM yourTable"
Dim conn As New System.Data.OleDb.OleDbConnection(sConnectionString)
Dim cmd As New System.Data.OleDb.OleDbCommand(sSQL, conn)
Dim dr As System.Data.OleDb.OleDbDataReader
conn.Open()
dr = cmd.ExecuteReader()
Do While dr.Read()
System.Console.WriteLine(dr.Item("Title"))
Loop
dr.Close()
conn.Close()
End Sub
End Module
Module Test
Sub Main()
Dim sConnectionString, sSQL As String
'SQL Connection String
sConnectionString = "Provider=SQLOLEDB.1;User ID=sa;Initial Catalog=YourDataBase;Data Source=(local)"
sSQL = "SELECT Title FROM yourTable"
Dim conn As New System.Data.OleDb.OleDbConnection(sConnectionString)
Dim cmd As New System.Data.OleDb.OleDbCommand(sSQL, conn)
Dim dr As System.Data.OleDb.OleDbDataReader
conn.Open()
dr = cmd.ExecuteReader()
Do While dr.Read()
System.Console.WriteLine(dr.Item("Title"))
Loop
dr.Close()
conn.Close()
End Sub
End Module
DataView - Find a value in DataView
Imports System.Windows.Forms
Imports System.Data
Imports System.Data.OleDb
public class FindAValueInDataView
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim contacts_table As New DataTable("Contacts")
' Add columns.
contacts_table.Columns.Add("FirstName", GetType(String))
contacts_table.Columns.Add("LastName", GetType(String))
contacts_table.Columns.Add("Street", GetType(String))
contacts_table.Columns.Add("City", GetType(String))
contacts_table.Columns.Add("State", GetType(String))
contacts_table.Columns.Add("Zip", GetType(String))
contacts_table.Rows.Add(New Object() {"A", "A", _
"1234", "B", "A", "11111"})
contacts_table.Rows.Add(New Object() {"B", "B", _
"22", "B", "C", "22222"})
contacts_table.Rows.Add(New Object() {"C", "C", _
"3", "P", "K", "33333"})
contacts_table.Rows.Add(New Object() {"", "D", _
"4", "P", "KS", "44444"})
grdAll.DataSource = contacts_table
grdAll.CaptionText = "All Records"
Dim dv_name As New DataView(contacts_table)
dv_name.RowFilter = "FirstName >= 'A'"
grdName.DataSource = dv_name
grdName.CaptionText = "LastName >= E"
dv_name.Sort = "FirstName, LastName"
MessageBox.Show(dv_name.Find(New String() {"A", "A"}).ToString)
End Sub
End Class
_
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
_
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
_
Private Sub InitializeComponent()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer
Me.grdAll = New System.Windows.Forms.DataGrid
Me.grdCO = New System.Windows.Forms.DataGrid
Me.grdName = New System.Windows.Forms.DataGrid
Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout()
Me.SplitContainer2.Panel1.SuspendLayout()
Me.SplitContainer2.Panel2.SuspendLayout()
Me.SplitContainer2.SuspendLayout()
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'SplitContainer1
'
Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer1.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer1.Name = "SplitContainer1"
Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer1.Panel1
'
Me.SplitContainer1.Panel1.Controls.Add(Me.grdAll)
'
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.SplitContainer2)
Me.SplitContainer1.Size = New System.Drawing.Size(519, 485)
Me.SplitContainer1.SplitterDistance = 180
Me.SplitContainer1.TabIndex = 2
Me.SplitContainer1.Text = "SplitContainer1"
'
'SplitContainer2
'
Me.SplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer2.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer2.Name = "SplitContainer2"
Me.SplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer2.Panel1
'
Me.SplitContainer2.Panel1.Controls.Add(Me.grdCO)
'
'SplitContainer2.Panel2
'
Me.SplitContainer2.Panel2.Controls.Add(Me.grdName)
Me.SplitContainer2.Size = New System.Drawing.Size(519, 301)
Me.SplitContainer2.SplitterDistance = 173
Me.SplitContainer2.TabIndex = 0
Me.SplitContainer2.Text = "SplitContainer2"
'
'grdAll
'
Me.grdAll.DataMember = ""
Me.grdAll.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdAll.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdAll.Location = New System.Drawing.Point(0, 0)
Me.grdAll.Name = "grdAll"
Me.grdAll.Size = New System.Drawing.Size(519, 180)
Me.grdAll.TabIndex = 0
'
'grdCO
'
Me.grdCO.DataMember = ""
Me.grdCO.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdCO.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdCO.Location = New System.Drawing.Point(0, 0)
Me.grdCO.Name = "grdCO"
Me.grdCO.Size = New System.Drawing.Size(519, 173)
Me.grdCO.TabIndex = 1
'
'grdName
'
Me.grdName.DataMember = ""
Me.grdName.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdName.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdName.Location = New System.Drawing.Point(0, 0)
Me.grdName.Name = "grdName"
Me.grdName.Size = New System.Drawing.Size(519, 124)
Me.grdName.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(519, 485)
Me.Controls.Add(Me.SplitContainer1)
Me.Name = "Form1"
Me.Text = "Contacts"
Me.SplitContainer1.Panel1.ResumeLayout(False)
Me.SplitContainer1.Panel2.ResumeLayout(False)
Me.SplitContainer1.ResumeLayout(False)
Me.SplitContainer2.Panel1.ResumeLayout(False)
Me.SplitContainer2.Panel2.ResumeLayout(False)
Me.SplitContainer2.ResumeLayout(False)
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer
Friend WithEvents grdAll As System.Windows.Forms.DataGrid
Friend WithEvents SplitContainer2 As System.Windows.Forms.SplitContainer
Friend WithEvents grdCO As System.Windows.Forms.DataGrid
Friend WithEvents grdName As System.Windows.Forms.DataGrid
End Class
Imports System.Data
Imports System.Data.OleDb
public class FindAValueInDataView
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim contacts_table As New DataTable("Contacts")
' Add columns.
contacts_table.Columns.Add("FirstName", GetType(String))
contacts_table.Columns.Add("LastName", GetType(String))
contacts_table.Columns.Add("Street", GetType(String))
contacts_table.Columns.Add("City", GetType(String))
contacts_table.Columns.Add("State", GetType(String))
contacts_table.Columns.Add("Zip", GetType(String))
contacts_table.Rows.Add(New Object() {"A", "A", _
"1234", "B", "A", "11111"})
contacts_table.Rows.Add(New Object() {"B", "B", _
"22", "B", "C", "22222"})
contacts_table.Rows.Add(New Object() {"C", "C", _
"3", "P", "K", "33333"})
contacts_table.Rows.Add(New Object() {"", "D", _
"4", "P", "KS", "44444"})
grdAll.DataSource = contacts_table
grdAll.CaptionText = "All Records"
Dim dv_name As New DataView(contacts_table)
dv_name.RowFilter = "FirstName >= 'A'"
grdName.DataSource = dv_name
grdName.CaptionText = "LastName >= E"
dv_name.Sort = "FirstName, LastName"
MessageBox.Show(dv_name.Find(New String() {"A", "A"}).ToString)
End Sub
End Class
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer
Me.grdAll = New System.Windows.Forms.DataGrid
Me.grdCO = New System.Windows.Forms.DataGrid
Me.grdName = New System.Windows.Forms.DataGrid
Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout()
Me.SplitContainer2.Panel1.SuspendLayout()
Me.SplitContainer2.Panel2.SuspendLayout()
Me.SplitContainer2.SuspendLayout()
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'SplitContainer1
'
Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer1.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer1.Name = "SplitContainer1"
Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer1.Panel1
'
Me.SplitContainer1.Panel1.Controls.Add(Me.grdAll)
'
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.SplitContainer2)
Me.SplitContainer1.Size = New System.Drawing.Size(519, 485)
Me.SplitContainer1.SplitterDistance = 180
Me.SplitContainer1.TabIndex = 2
Me.SplitContainer1.Text = "SplitContainer1"
'
'SplitContainer2
'
Me.SplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer2.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer2.Name = "SplitContainer2"
Me.SplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer2.Panel1
'
Me.SplitContainer2.Panel1.Controls.Add(Me.grdCO)
'
'SplitContainer2.Panel2
'
Me.SplitContainer2.Panel2.Controls.Add(Me.grdName)
Me.SplitContainer2.Size = New System.Drawing.Size(519, 301)
Me.SplitContainer2.SplitterDistance = 173
Me.SplitContainer2.TabIndex = 0
Me.SplitContainer2.Text = "SplitContainer2"
'
'grdAll
'
Me.grdAll.DataMember = ""
Me.grdAll.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdAll.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdAll.Location = New System.Drawing.Point(0, 0)
Me.grdAll.Name = "grdAll"
Me.grdAll.Size = New System.Drawing.Size(519, 180)
Me.grdAll.TabIndex = 0
'
'grdCO
'
Me.grdCO.DataMember = ""
Me.grdCO.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdCO.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdCO.Location = New System.Drawing.Point(0, 0)
Me.grdCO.Name = "grdCO"
Me.grdCO.Size = New System.Drawing.Size(519, 173)
Me.grdCO.TabIndex = 1
'
'grdName
'
Me.grdName.DataMember = ""
Me.grdName.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdName.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdName.Location = New System.Drawing.Point(0, 0)
Me.grdName.Name = "grdName"
Me.grdName.Size = New System.Drawing.Size(519, 124)
Me.grdName.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(519, 485)
Me.Controls.Add(Me.SplitContainer1)
Me.Name = "Form1"
Me.Text = "Contacts"
Me.SplitContainer1.Panel1.ResumeLayout(False)
Me.SplitContainer1.Panel2.ResumeLayout(False)
Me.SplitContainer1.ResumeLayout(False)
Me.SplitContainer2.Panel1.ResumeLayout(False)
Me.SplitContainer2.Panel2.ResumeLayout(False)
Me.SplitContainer2.ResumeLayout(False)
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer
Friend WithEvents grdAll As System.Windows.Forms.DataGrid
Friend WithEvents SplitContainer2 As System.Windows.Forms.SplitContainer
Friend WithEvents grdCO As System.Windows.Forms.DataGrid
Friend WithEvents grdName As System.Windows.Forms.DataGrid
End Class
DataSet - Build up a DataSet
Imports System.Data.SqlClient
Imports System.Data
Module Module1
Sub Main()
Try
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
Dim XMLContent As String = DS.GetXml()
Dim I As Integer
For I = 0 To DS.Tables(0).Rows.Count - 1
DS.Tables(0).Rows(I).Item("Author") = UCase(DS.Tables(0).Rows(I).Item("Author"))
Next
For I = 0 To DS.Tables(0).Rows.Count - 1
Console.WriteLine(DS.Tables(0).Rows(I).Item("Title"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Author"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Publisher"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Price"))
Next
DS.WriteXml("NewAuthors.xml")
Catch Ex As Exception
Console.WriteLine("Exception: " & Ex.Message)
Console.WriteLine(Ex.ToString)
Console.ReadLine()
End Try
End Sub
End Module
Imports System.Data
Module Module1
Sub Main()
Try
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
Dim XMLContent As String = DS.GetXml()
Dim I As Integer
For I = 0 To DS.Tables(0).Rows.Count - 1
DS.Tables(0).Rows(I).Item("Author") = UCase(DS.Tables(0).Rows(I).Item("Author"))
Next
For I = 0 To DS.Tables(0).Rows.Count - 1
Console.WriteLine(DS.Tables(0).Rows(I).Item("Title"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Author"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Publisher"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Price"))
Next
DS.WriteXml("NewAuthors.xml")
Catch Ex As Exception
Console.WriteLine("Exception: " & Ex.Message)
Console.WriteLine(Ex.ToString)
Console.ReadLine()
End Try
End Sub
End Module
DataSet XML - Save data in DataSet to xml file
Imports System.Data.SqlClient
Imports System.Data
Module Module1
Sub Main()
Try
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
Dim XMLContent As String = DS.GetXml()
Dim I As Integer
For I = 0 To DS.Tables(0).Rows.Count - 1
DS.Tables(0).Rows(I).Item("Author") = UCase(DS.Tables(0).Rows(I).Item("Author"))
Next
For I = 0 To DS.Tables(0).Rows.Count - 1
Console.WriteLine(DS.Tables(0).Rows(I).Item("Title"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Author"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Publisher"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Price"))
Next
DS.WriteXml("NewAuthors.xml")
Console.ReadLine()
Catch Ex As Exception
Console.WriteLine("Exception: " & Ex.Message)
Console.WriteLine(Ex.ToString)
End Try
End Sub
End Module
Imports System.Data
Module Module1
Sub Main()
Try
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
Dim XMLContent As String = DS.GetXml()
Dim I As Integer
For I = 0 To DS.Tables(0).Rows.Count - 1
DS.Tables(0).Rows(I).Item("Author") = UCase(DS.Tables(0).Rows(I).Item("Author"))
Next
For I = 0 To DS.Tables(0).Rows.Count - 1
Console.WriteLine(DS.Tables(0).Rows(I).Item("Title"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Author"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Publisher"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Price"))
Next
DS.WriteXml("NewAuthors.xml")
Console.ReadLine()
Catch Ex As Exception
Console.WriteLine("Exception: " & Ex.Message)
Console.WriteLine(Ex.ToString)
End Try
End Sub
End Module
DataSet XML - Load XML data to Data
Imports System.Data.SqlClient
Imports System.Data
Module Module1
Sub Main()
Try
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
Dim XMLContent As String = DS.GetXml()
Dim I As Integer
For I = 0 To DS.Tables(0).Rows.Count - 1
Console.WriteLine(DS.Tables(0).Rows(I).Item("Title"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Author"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Publisher"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Price"))
Next
Catch Ex As Exception
Console.WriteLine("Exception: " & Ex.Message)
Console.WriteLine(Ex.ToString)
End Try
End Sub
End Module
Imports System.Data
Module Module1
Sub Main()
Try
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
Dim XMLContent As String = DS.GetXml()
Dim I As Integer
For I = 0 To DS.Tables(0).Rows.Count - 1
Console.WriteLine(DS.Tables(0).Rows(I).Item("Title"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Author"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Publisher"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Price"))
Next
Catch Ex As Exception
Console.WriteLine("Exception: " & Ex.Message)
Console.WriteLine(Ex.ToString)
End Try
End Sub
End Module
DATA GRID VIEW - Read data in SqlServer to DataGridView

Imports System.Data.SqlClient
Imports System.Data
Imports System.Windows.Forms
public class ReadDataFromSqlServer
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
''Dim sConnString As String = "server=vs-lv;uid=sa;pwd=;database=Northwind"
Dim ConnString As String = "Data Source=vs-lv;Initial Catalog=Northwind;Integrated Security=True"
Dim SQLString As String = "SELECT * FROM Customers"
Dim SqlDataAdapter1 As New SqlDataAdapter(SQLString, ConnString)
Dim DataSet1 As New DataSet()
SqlDataAdapter1.Fill(DataSet1, "Customers")
DataGridView1.DataSource = DataSet1.Tables("Customers")
End Sub
End Class
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.DataGridView1 = New System.Windows.Forms.DataGridView
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(35, 289)
Me.Button1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(229, 29)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Read SQL Server 2000"
Me.Button1.UseVisualStyleBackColor = True
'
'DataGridView1
'
Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.DataGridView1.Location = New System.Drawing.Point(16, 15)
Me.DataGridView1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.DataGridView1.Name = "DataGridView1"
Me.DataGridView1.RowTemplate.Height = 23
Me.DataGridView1.Size = New System.Drawing.Size(503, 266)
Me.DataGridView1.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(535, 332)
Me.Controls.Add(Me.DataGridView1)
Me.Controls.Add(Me.Button1)
Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.Name = "Form1"
Me.Text = "Form1"
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView
End Class
DATA GRID VIEW - Load data in Access to DataGridView

Imports System.Data.OleDb
Imports System.Data
Imports System.Windows.Forms
public class LoadAccessDataToDataView
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyMDB.mdb"
Dim SQLString As String = "SELECT * FROM TestDB"
Dim OleDBConn1 As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(ConnString)
Dim DataSet1 As New DataSet()
Dim OleDbDataAdapter1 As System.Data.OleDb.OleDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter(SQLString, OleDBConn1)
OleDBConn1.Open()
OleDbDataAdapter1.Fill(DataSet1, "TestDB")
DataGridView1.DataSource = DataSet1.Tables("TestDB")
End Sub
End Class
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.DataGridView1 = New System.Windows.Forms.DataGridView
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(35, 289)
Me.Button1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(171, 29)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Read Access"
Me.Button1.UseVisualStyleBackColor = True
'
'DataGridView1
'
Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.DataGridView1.Location = New System.Drawing.Point(16, 15)
Me.DataGridView1.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
Me.DataGridView1.Name = "DataGridView1"
Me.DataGridView1.RowTemplate.Height = 23
Me.DataGridView1.Size = New System.Drawing.Size(503, 266)
Me.DataGridView1.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(535, 332)
Me.Controls.Add(Me.DataGridView1)
Me.Controls.Add(Me.Button1)
Me.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4)
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents DataGridView1 As System.Windows.Forms.DataGridView
End Class
DATA GRID - DataSet Relation

Imports System.Data
Imports System.Data.OleDb
Imports System.Windows.Forms
public class DataSetWithRelation
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim scores_dataset As New DataSet("Scores")
Dim students_table As DataTable = scores_dataset.Tables.Add("Students")
students_table.Columns.Add("FirstName", GetType(String))
students_table.Columns.Add("LastName", GetType(String))
students_table.Columns.Add("StudentId", GetType(Integer))
students_table.Columns("StudentId").Unique = True
Dim first_last_columns() As DataColumn = { _
students_table.Columns("FirstName"), _
students_table.Columns("LastName") _
}
students_table.Constraints.Add(New UniqueConstraint(first_last_columns))
Dim test_scores_table As DataTable = scores_dataset.Tables.Add("TestScores")
test_scores_table.Columns.Add("StudentId", GetType(Integer))
test_scores_table.Columns.Add("TestNumber", GetType(Integer))
test_scores_table.Columns.Add("Score", GetType(Integer))
Dim studentid_testnumber_score_columns() As DataColumn = { _
test_scores_table.Columns("StudentId"),test_scores_table.Columns("TestNumber") _
}
test_scores_table.Constraints.Add(New UniqueConstraint(studentid_testnumber_score_columns))
scores_dataset.Relations.Add("Student Test Scores",students_table.Columns("StudentId"),test_scores_table.Columns("StudentId"))
students_table.Rows.Add(New Object() {"A", "A", 1})
students_table.Rows.Add(New Object() {"B", "B", 2})
students_table.Rows.Add(New Object() {"C", "C", 3})
students_table.Rows.Add(New Object() {"D", "D", 4})
Dim score As New Random
For id As Integer = 1 To 4
For test_num As Integer = 1 To 10
test_scores_table.Rows.Add( _
New Object() {id, test_num, score.Next(65, 100)})
Next test_num
Next id
students_table.Rows(1).SetColumnError(2, "Bad name format")
students_table.Rows(2).RowError = "Missing registration"
grdScores.DataSource = scores_dataset
End Sub
End Class
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.grdScores = New System.Windows.Forms.DataGrid
CType(Me.grdScores, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'grdScores
'
Me.grdScores.DataMember = ""
Me.grdScores.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdScores.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdScores.Location = New System.Drawing.Point(0, 0)
Me.grdScores.Name = "grdScores"
Me.grdScores.Size = New System.Drawing.Size(292, 273)
Me.grdScores.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.grdScores)
Me.Name = "Form1"
Me.Text = "MemoryDataSetWithError"
CType(Me.grdScores, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents grdScores As System.Windows.Forms.DataGrid
End Class
DATA GRID with Error mark
Imports System.Data
Imports System.Data.OleDb
Imports System.Windows.Forms
public class DataGridWithError
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim scores_dataset As New DataSet("Scores")
Dim students_table As DataTable = scores_dataset.Tables.Add("Students")
students_table.Columns.Add("FirstName", GetType(String))
students_table.Columns.Add("LastName", GetType(String))
students_table.Columns.Add("StudentId", GetType(Integer))
students_table.Columns("StudentId").Unique = True
Dim first_last_columns() As DataColumn = { _
students_table.Columns("FirstName"), _
students_table.Columns("LastName") _
}
students_table.Constraints.Add(New UniqueConstraint(first_last_columns))
Dim test_scores_table As DataTable = scores_dataset.Tables.Add("TestScores")
test_scores_table.Columns.Add("StudentId", GetType(Integer))
test_scores_table.Columns.Add("TestNumber", GetType(Integer))
test_scores_table.Columns.Add("Score", GetType(Integer))
Dim studentid_testnumber_score_columns() As DataColumn = { _
test_scores_table.Columns("StudentId"),test_scores_table.Columns("TestNumber") _
}
test_scores_table.Constraints.Add(New UniqueConstraint(studentid_testnumber_score_columns))
scores_dataset.Relations.Add("Student Test Scores",students_table.Columns("StudentId"),test_scores_table.Columns("StudentId"))
students_table.Rows.Add(New Object() {"A", "A", 1})
students_table.Rows.Add(New Object() {"B", "B", 2})
students_table.Rows.Add(New Object() {"C", "C", 3})
students_table.Rows.Add(New Object() {"D", "D", 4})
Dim score As New Random
For id As Integer = 1 To 4
For test_num As Integer = 1 To 10
test_scores_table.Rows.Add( _
New Object() {id, test_num, score.Next(65, 100)})
Next test_num
Next id
students_table.Rows(1).SetColumnError(2, "Bad name format")
students_table.Rows(2).RowError = "Missing registration"
grdScores.DataSource = scores_dataset
End Sub
End Class
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.grdScores = New System.Windows.Forms.DataGrid
CType(Me.grdScores, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'grdScores
'
Me.grdScores.DataMember = ""
Me.grdScores.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdScores.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdScores.Location = New System.Drawing.Point(0, 0)
Me.grdScores.Name = "grdScores"
Me.grdScores.Size = New System.Drawing.Size(292, 273)
Me.grdScores.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.grdScores)
Me.Name = "Form1"
Me.Text = "MemoryDataSetWithError"
CType(Me.grdScores, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents grdScores As System.Windows.Forms.DataGrid
End Class
DATA GRID - Load XML data to DataGrid
Imports System.Data.SqlClient
Imports System.Data
Imports System.Windows.Forms
public class XMLDataGrid
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Private Sub InitializeComponent()
Me.DataGrid1 = New System.Windows.Forms.DataGrid()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(16, 32)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(664, 160)
Me.DataGrid1.TabIndex = 0
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(736, 273)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.DataGrid1})
Me.Name = "Form1"
Me.Text = "DataGrid Demo"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
DataGrid1.CaptionText = "Book Information"
DataGrid1.SetDataBinding(DS, "Table")
End Sub
End Class
Imports System.Data
Imports System.Windows.Forms
public class XMLDataGrid
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Me.DataGrid1 = New System.Windows.Forms.DataGrid()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(16, 32)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(664, 160)
Me.DataGrid1.TabIndex = 0
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(736, 273)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.DataGrid1})
Me.Name = "Form1"
Me.Text = "DataGrid Demo"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
DataGrid1.CaptionText = "Book Information"
DataGrid1.SetDataBinding(DS, "Table")
End Sub
End Class
DATA GRID - Use DataView to filter data table

Imports System.Windows.Forms
Imports System.Data
Imports System.Data.OleDb
public class CreateDataTableAndFilteredByDataView
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim contacts_table As New DataTable("Contacts")
' Add columns.
contacts_table.Columns.Add("FirstName", GetType(String))
contacts_table.Columns.Add("LastName", GetType(String))
contacts_table.Columns.Add("Street", GetType(String))
contacts_table.Columns.Add("City", GetType(String))
contacts_table.Columns.Add("State", GetType(String))
contacts_table.Columns.Add("Zip", GetType(String))
contacts_table.Rows.Add(New Object() {"A", "A", _
"1234", "B", "A", "11111"})
contacts_table.Rows.Add(New Object() {"B", "B", _
"22", "B", "C", "22222"})
contacts_table.Rows.Add(New Object() {"C", "C", _
"3", "P", "K", "33333"})
contacts_table.Rows.Add(New Object() {"", "D", _
"4", "P", "KS", "44444"})
grdAll.DataSource = contacts_table
grdAll.CaptionText = "All Records"
Dim dv_co As New DataView(contacts_table)
dv_co.RowFilter = "State = 'C'"
grdCO.DataSource = dv_co
grdCO.CaptionText = "CO Records"
End Sub
End Class
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer
Me.grdAll = New System.Windows.Forms.DataGrid
Me.grdCO = New System.Windows.Forms.DataGrid
Me.grdName = New System.Windows.Forms.DataGrid
Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout()
Me.SplitContainer2.Panel1.SuspendLayout()
Me.SplitContainer2.Panel2.SuspendLayout()
Me.SplitContainer2.SuspendLayout()
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'SplitContainer1
'
Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer1.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer1.Name = "SplitContainer1"
Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer1.Panel1
'
Me.SplitContainer1.Panel1.Controls.Add(Me.grdAll)
'
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.SplitContainer2)
Me.SplitContainer1.Size = New System.Drawing.Size(519, 485)
Me.SplitContainer1.SplitterDistance = 180
Me.SplitContainer1.TabIndex = 2
Me.SplitContainer1.Text = "SplitContainer1"
'
'SplitContainer2
'
Me.SplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer2.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer2.Name = "SplitContainer2"
Me.SplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer2.Panel1
'
Me.SplitContainer2.Panel1.Controls.Add(Me.grdCO)
'
'SplitContainer2.Panel2
'
Me.SplitContainer2.Panel2.Controls.Add(Me.grdName)
Me.SplitContainer2.Size = New System.Drawing.Size(519, 301)
Me.SplitContainer2.SplitterDistance = 173
Me.SplitContainer2.TabIndex = 0
Me.SplitContainer2.Text = "SplitContainer2"
'
'grdAll
'
Me.grdAll.DataMember = ""
Me.grdAll.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdAll.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdAll.Location = New System.Drawing.Point(0, 0)
Me.grdAll.Name = "grdAll"
Me.grdAll.Size = New System.Drawing.Size(519, 180)
Me.grdAll.TabIndex = 0
'
'grdCO
'
Me.grdCO.DataMember = ""
Me.grdCO.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdCO.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdCO.Location = New System.Drawing.Point(0, 0)
Me.grdCO.Name = "grdCO"
Me.grdCO.Size = New System.Drawing.Size(519, 173)
Me.grdCO.TabIndex = 1
'
'grdName
'
Me.grdName.DataMember = ""
Me.grdName.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdName.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdName.Location = New System.Drawing.Point(0, 0)
Me.grdName.Name = "grdName"
Me.grdName.Size = New System.Drawing.Size(519, 124)
Me.grdName.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(519, 485)
Me.Controls.Add(Me.SplitContainer1)
Me.Name = "Form1"
Me.Text = "Contacts"
Me.SplitContainer1.Panel1.ResumeLayout(False)
Me.SplitContainer1.Panel2.ResumeLayout(False)
Me.SplitContainer1.ResumeLayout(False)
Me.SplitContainer2.Panel1.ResumeLayout(False)
Me.SplitContainer2.Panel2.ResumeLayout(False)
Me.SplitContainer2.ResumeLayout(False)
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer
Friend WithEvents grdAll As System.Windows.Forms.DataGrid
Friend WithEvents SplitContainer2 As System.Windows.Forms.SplitContainer
Friend WithEvents grdCO As System.Windows.Forms.DataGrid
Friend WithEvents grdName As System.Windows.Forms.DataGrid
End Class
DATA GRID - Make the combined FirstName/LastName unique

Imports System.Windows.Forms
Imports System.Data
Imports System.Data.OleDb
public class CreateDataTableAndMakeCombinedColumnUnique
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim contacts_table As New DataTable("Contacts")
' Add columns.
contacts_table.Columns.Add("FirstName", GetType(String))
contacts_table.Columns.Add("LastName", GetType(String))
contacts_table.Columns.Add("Street", GetType(String))
contacts_table.Columns.Add("City", GetType(String))
contacts_table.Columns.Add("State", GetType(String))
contacts_table.Columns.Add("Zip", GetType(String))
' Make the combined FirstName/LastName unique.
Dim first_last_columns() As DataColumn = { _
contacts_table.Columns("FirstName"), _
contacts_table.Columns("LastName") _
}
contacts_table.Constraints.Add( _
New UniqueConstraint(first_last_columns))
' Make some contact data.
contacts_table.Rows.Add(New Object() {"A", "A", _
"1234", "B", "A", "11111"})
contacts_table.Rows.Add(New Object() {"B", "B", _
"22", "B", "C", "22222"})
contacts_table.Rows.Add(New Object() {"C", "C", _
"3", "P", "K", "33333"})
contacts_table.Rows.Add(New Object() {"", "D", _
"4", "P", "KS", "44444"})
grdAll.DataSource = contacts_table
grdAll.CaptionText = "All Records"
End Sub
End Class
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer
Me.grdAll = New System.Windows.Forms.DataGrid
Me.grdCO = New System.Windows.Forms.DataGrid
Me.grdName = New System.Windows.Forms.DataGrid
Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout()
Me.SplitContainer2.Panel1.SuspendLayout()
Me.SplitContainer2.Panel2.SuspendLayout()
Me.SplitContainer2.SuspendLayout()
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'SplitContainer1
'
Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer1.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer1.Name = "SplitContainer1"
Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer1.Panel1
'
Me.SplitContainer1.Panel1.Controls.Add(Me.grdAll)
'
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.SplitContainer2)
Me.SplitContainer1.Size = New System.Drawing.Size(519, 485)
Me.SplitContainer1.SplitterDistance = 180
Me.SplitContainer1.TabIndex = 2
Me.SplitContainer1.Text = "SplitContainer1"
'
'SplitContainer2
'
Me.SplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer2.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer2.Name = "SplitContainer2"
Me.SplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer2.Panel1
'
Me.SplitContainer2.Panel1.Controls.Add(Me.grdCO)
'
'SplitContainer2.Panel2
'
Me.SplitContainer2.Panel2.Controls.Add(Me.grdName)
Me.SplitContainer2.Size = New System.Drawing.Size(519, 301)
Me.SplitContainer2.SplitterDistance = 173
Me.SplitContainer2.TabIndex = 0
Me.SplitContainer2.Text = "SplitContainer2"
'
'grdAll
'
Me.grdAll.DataMember = ""
Me.grdAll.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdAll.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdAll.Location = New System.Drawing.Point(0, 0)
Me.grdAll.Name = "grdAll"
Me.grdAll.Size = New System.Drawing.Size(519, 180)
Me.grdAll.TabIndex = 0
'
'grdCO
'
Me.grdCO.DataMember = ""
Me.grdCO.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdCO.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdCO.Location = New System.Drawing.Point(0, 0)
Me.grdCO.Name = "grdCO"
Me.grdCO.Size = New System.Drawing.Size(519, 173)
Me.grdCO.TabIndex = 1
'
'grdName
'
Me.grdName.DataMember = ""
Me.grdName.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdName.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdName.Location = New System.Drawing.Point(0, 0)
Me.grdName.Name = "grdName"
Me.grdName.Size = New System.Drawing.Size(519, 124)
Me.grdName.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(519, 485)
Me.Controls.Add(Me.SplitContainer1)
Me.Name = "Form1"
Me.Text = "Contacts"
Me.SplitContainer1.Panel1.ResumeLayout(False)
Me.SplitContainer1.Panel2.ResumeLayout(False)
Me.SplitContainer1.ResumeLayout(False)
Me.SplitContainer2.Panel1.ResumeLayout(False)
Me.SplitContainer2.Panel2.ResumeLayout(False)
Me.SplitContainer2.ResumeLayout(False)
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer
Friend WithEvents grdAll As System.Windows.Forms.DataGrid
Friend WithEvents SplitContainer2 As System.Windows.Forms.SplitContainer
Friend WithEvents grdCO As System.Windows.Forms.DataGrid
Friend WithEvents grdName As System.Windows.Forms.DataGrid
End Class
DATA GRID - Add DataRow to DataGrid

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Windows.Forms
public class DataBinding
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private components As System.ComponentModel.IContainer
Friend WithEvents DataSet1 As System.Data.DataSet
Friend WithEvents DataTable1 As System.Data.DataTable
Friend WithEvents DataColumn1 As System.Data.DataColumn
Friend WithEvents DataColumn2 As System.Data.DataColumn
Friend WithEvents DataColumn3 As System.Data.DataColumn
Friend WithEvents DataColumn4 As System.Data.DataColumn
Friend WithEvents DataColumn5 As System.Data.DataColumn
Friend WithEvents DataColumn6 As System.Data.DataColumn
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Me.DataSet1 = New System.Data.DataSet
Me.DataTable1 = New System.Data.DataTable
Me.DataColumn1 = New System.Data.DataColumn
Me.DataColumn2 = New System.Data.DataColumn
Me.DataColumn3 = New System.Data.DataColumn
Me.DataColumn4 = New System.Data.DataColumn
Me.DataColumn5 = New System.Data.DataColumn
Me.DataColumn6 = New System.Data.DataColumn
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label2 = New System.Windows.Forms.Label
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Label3 = New System.Windows.Forms.Label
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.Label4 = New System.Windows.Forms.Label
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.Label5 = New System.Windows.Forms.Label
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.Label6 = New System.Windows.Forms.Label
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
CType(Me.DataSet1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataTable1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataSet1
'
Me.DataSet1.DataSetName = "NewDataSet"
Me.DataSet1.Locale = New System.Globalization.CultureInfo("zh-CN")
Me.DataSet1.Tables.AddRange(New System.Data.DataTable() {Me.DataTable1})
'
'DataTable1
'
Me.DataTable1.Columns.AddRange(New System.Data.DataColumn() {Me.DataColumn1, Me.DataColumn2, Me.DataColumn3, Me.DataColumn4, Me.DataColumn5, Me.DataColumn6})
Me.DataTable1.TableName = "Table1"
'
'DataColumn1
'
Me.DataColumn1.Caption = "A"
Me.DataColumn1.ColumnName = "A"
'
'DataColumn2
'
Me.DataColumn2.ColumnName = "B"
Me.DataColumn2.DataType = GetType(System.Int32)
'
'DataColumn3
'
Me.DataColumn3.Caption = "C"
Me.DataColumn3.ColumnName = "C"
Me.DataColumn3.DataType = GetType(System.Int32)
'
'DataColumn4
'
Me.DataColumn4.ColumnName = "D"
Me.DataColumn4.DataType = GetType(System.Int32)
'
'DataColumn5
'
Me.DataColumn5.ColumnName = "E"
Me.DataColumn5.DataType = GetType(System.Int32)
'
'DataColumn6
'
Me.DataColumn6.ColumnName = "F"
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.DataSource = Me.DataTable1
Me.DataGrid1.Dock = System.Windows.Forms.DockStyle.Top
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(0, 0)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(488, 216)
Me.DataGrid1.TabIndex = 0
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(24, 224)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(48, 24)
Me.Label1.TabIndex = 1
Me.Label1.Text = "A"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(64, 224)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(64, 20)
Me.TextBox1.TabIndex = 2
Me.TextBox1.Text = ""
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(168, 224)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(48, 24)
Me.Label2.TabIndex = 3
Me.Label2.Text = "B"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(216, 224)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(72, 20)
Me.TextBox2.TabIndex = 4
Me.TextBox2.Text = ""
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(24, 256)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(48, 24)
Me.Label3.TabIndex = 5
Me.Label3.Text = "C"
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(64, 256)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(64, 20)
Me.TextBox3.TabIndex = 6
Me.TextBox3.Text = ""
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(168, 256)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(48, 24)
Me.Label4.TabIndex = 7
Me.Label4.Text = "D"
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(216, 256)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(72, 20)
Me.TextBox4.TabIndex = 8
Me.TextBox4.Text = ""
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(24, 288)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(48, 24)
Me.Label5.TabIndex = 9
Me.Label5.Text = "E"
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(64, 288)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(64, 20)
Me.TextBox5.TabIndex = 10
Me.TextBox5.Text = ""
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(144, 288)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(80, 24)
Me.Label6.TabIndex = 11
Me.Label6.Text = "F"
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(216, 288)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(72, 20)
Me.TextBox6.TabIndex = 12
Me.TextBox6.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(328, 224)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 24)
Me.Button1.TabIndex = 13
Me.Button1.Text = "Display"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(328, 264)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(72, 24)
Me.Button2.TabIndex = 14
Me.Button2.Text = "Add"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(488, 318)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.DataGrid1)
CType(Me.DataSet1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataTable1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim row1 As DataRow
row1 = DataTable1.NewRow
row1("A") = "Tom"
row1("B") = 121
row1("C") = 145
row1("D") = 134
row1("E") = 127
row1("F") = "032158"
DataTable1.Rows.Add(row1)
row1 = DataTable1.NewRow
row1("A") = "John"
row1("B") = 95
row1("C") = 102
row1("D") = 94
row1("E") = 85
row1("F") = "032176"
DataTable1.Rows.Add(row1)
row1 = DataTable1.NewRow
row1("A") = "Alice"
row1("B") = 137
row1("C") = 96
row1("D") = 125
row1("E") = 94
row1("F") = "032152"
DataTable1.Rows.Add(row1)
row1 = DataTable1.NewRow
row1("A") = "Jack"
row1("B") = 98
row1("C") = 134
row1("D") = 87
row1("E") = 124
row1("F") = "032156"
DataTable1.Rows.Add(row1)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim row1 As DataRow
row1 = DataTable1.NewRow
row1("A") = TextBox1.Text
row1("B") = 123
row1("C") = 123
row1("D") = 123
row1("E") = 123
row1("F") = TextBox6.Text
DataTable1.Rows.Add(row1)
DataTable1.AcceptChanges()
End Sub
End Class
DATA GRID - Create DataTable and add to DataGrid

Imports System.Windows.Forms
Imports System.Data
Imports System.Data.OleDb
public class CreateDataTableAndAddToDataGrid
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim contacts_table As New DataTable("Contacts")
' Add columns.
contacts_table.Columns.Add("FirstName", GetType(String))
contacts_table.Columns.Add("LastName", GetType(String))
contacts_table.Columns.Add("Street", GetType(String))
contacts_table.Columns.Add("City", GetType(String))
contacts_table.Columns.Add("State", GetType(String))
contacts_table.Columns.Add("Zip", GetType(String))
' Make some contact data.
contacts_table.Rows.Add(New Object() {"A", "A", _
"1234", "B", "A", "11111"})
contacts_table.Rows.Add(New Object() {"B", "B", _
"22", "B", "C", "22222"})
contacts_table.Rows.Add(New Object() {"C", "C", _
"3", "P", "K", "33333"})
contacts_table.Rows.Add(New Object() {"", "D", _
"4", "P", "KS", "44444"})
grdAll.DataSource = contacts_table
grdAll.CaptionText = "All Records"
End Sub
End Class
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer
Me.grdAll = New System.Windows.Forms.DataGrid
Me.grdCO = New System.Windows.Forms.DataGrid
Me.grdName = New System.Windows.Forms.DataGrid
Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout()
Me.SplitContainer2.Panel1.SuspendLayout()
Me.SplitContainer2.Panel2.SuspendLayout()
Me.SplitContainer2.SuspendLayout()
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'SplitContainer1
'
Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer1.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer1.Name = "SplitContainer1"
Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer1.Panel1
'
Me.SplitContainer1.Panel1.Controls.Add(Me.grdAll)
'
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.SplitContainer2)
Me.SplitContainer1.Size = New System.Drawing.Size(519, 485)
Me.SplitContainer1.SplitterDistance = 180
Me.SplitContainer1.TabIndex = 2
Me.SplitContainer1.Text = "SplitContainer1"
'
'SplitContainer2
'
Me.SplitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer2.Location = New System.Drawing.Point(0, 0)
Me.SplitContainer2.Name = "SplitContainer2"
Me.SplitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer2.Panel1
'
Me.SplitContainer2.Panel1.Controls.Add(Me.grdCO)
'
'SplitContainer2.Panel2
'
Me.SplitContainer2.Panel2.Controls.Add(Me.grdName)
Me.SplitContainer2.Size = New System.Drawing.Size(519, 301)
Me.SplitContainer2.SplitterDistance = 173
Me.SplitContainer2.TabIndex = 0
Me.SplitContainer2.Text = "SplitContainer2"
'
'grdAll
'
Me.grdAll.DataMember = ""
Me.grdAll.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdAll.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdAll.Location = New System.Drawing.Point(0, 0)
Me.grdAll.Name = "grdAll"
Me.grdAll.Size = New System.Drawing.Size(519, 180)
Me.grdAll.TabIndex = 0
'
'grdCO
'
Me.grdCO.DataMember = ""
Me.grdCO.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdCO.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdCO.Location = New System.Drawing.Point(0, 0)
Me.grdCO.Name = "grdCO"
Me.grdCO.Size = New System.Drawing.Size(519, 173)
Me.grdCO.TabIndex = 1
'
'grdName
'
Me.grdName.DataMember = ""
Me.grdName.Dock = System.Windows.Forms.DockStyle.Fill
Me.grdName.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.grdName.Location = New System.Drawing.Point(0, 0)
Me.grdName.Name = "grdName"
Me.grdName.Size = New System.Drawing.Size(519, 124)
Me.grdName.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(519, 485)
Me.Controls.Add(Me.SplitContainer1)
Me.Name = "Form1"
Me.Text = "Contacts"
Me.SplitContainer1.Panel1.ResumeLayout(False)
Me.SplitContainer1.Panel2.ResumeLayout(False)
Me.SplitContainer1.ResumeLayout(False)
Me.SplitContainer2.Panel1.ResumeLayout(False)
Me.SplitContainer2.Panel2.ResumeLayout(False)
Me.SplitContainer2.ResumeLayout(False)
CType(Me.grdAll, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdCO, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.grdName, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer
Friend WithEvents grdAll As System.Windows.Forms.DataGrid
Friend WithEvents SplitContainer2 As System.Windows.Forms.SplitContainer
Friend WithEvents grdCO As System.Windows.Forms.DataGrid
Friend WithEvents grdName As System.Windows.Forms.DataGrid
End Class
BIND DATA TABLE TO CONTROL
Imports System.Data
Imports System.Data.OleDb
Imports System.Windows.Forms
public class BindDataTableToControl
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
Public Class Form1
' The data source.
Private m_ContactsTable As DataTable
' The data source's CurrencyManager.
Private m_CurrencyManager As CurrencyManager
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
' Make a DataTable.
m_ContactsTable = New DataTable("Contacts")
' Add columns.
m_ContactsTable.Columns.Add("FirstName", GetType(String))
m_ContactsTable.Columns.Add("LastName", GetType(String))
m_ContactsTable.Columns.Add("Street", GetType(String))
m_ContactsTable.Columns.Add("City", GetType(String))
m_ContactsTable.Columns.Add("State", GetType(String))
m_ContactsTable.Columns.Add("Zip", GetType(String))
' Make the combined FirstName/LastName unique.
Dim first_last_columns() As DataColumn = { _
m_ContactsTable.Columns("FirstName"), _
m_ContactsTable.Columns("LastName") _
}
m_ContactsTable.Constraints.Add( _
New UniqueConstraint(first_last_columns))
' Make some contact data.
m_ContactsTable.Rows.Add(New Object() {"A", "B","C", "D", "E", "11111"})
m_ContactsTable.Rows.Add(New Object() {"F", "G","H", "I", "J", "22222"})
m_ContactsTable.Rows.Add(New Object() {"K", "L","M", "N", "O", "33333"})
m_ContactsTable.Rows.Add(New Object() {"P", "Q","R", "S", "T", "44444"})
m_ContactsTable.Rows.Add(New Object() {"U", "V","W", "X", "Y", "55555"})
m_ContactsTable.Rows.Add(New Object() {"Z", "A","B", "C", "D", "66666"})
m_ContactsTable.Rows.Add(New Object() {"E", "F","G", "H", "I", "77777"})
m_ContactsTable.Rows.Add(New Object() {"J", "K","L", "M", "N", "88888"})
' Bind to controls.
txtFirstName.DataBindings.Add("Text", m_ContactsTable, "FirstName")
txtLastName.DataBindings.Add("Text", m_ContactsTable, "LastName")
txtStreet.DataBindings.Add("Text", m_ContactsTable, "Street")
txtCity.DataBindings.Add("Text", m_ContactsTable, "City")
txtState.DataBindings.Add("Text", m_ContactsTable, "State")
txtZip.DataBindings.Add("Text", m_ContactsTable, "Zip")
' Save a reference to the CurrencyManager.
m_CurrencyManager = _
DirectCast(Me.BindingContext(m_ContactsTable), CurrencyManager)
End Sub
Private Sub btnFirst_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnFirst.Click
m_CurrencyManager.Position = 0
End Sub
Private Sub btnPrev_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnPrev.Click
m_CurrencyManager.Position -= 1
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnNext.Click
m_CurrencyManager.Position += 1
End Sub
Private Sub btnLast_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnLast.Click
m_CurrencyManager.Position = m_CurrencyManager.Count - 1
End Sub
' Add a new record.
Private Sub btnAdd_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click
m_CurrencyManager.AddNew()
End Sub
Private Sub btnDelete_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnDelete.Click
If MsgBox("Are you sure you want to delete this record?", _
MsgBoxStyle.Question Or MsgBoxStyle.YesNo, _
"Confirm Delete?") = MsgBoxResult.Yes _
Then
m_CurrencyManager.RemoveAt(m_CurrencyManager.Position)
End If
End Sub
End Class
Partial Public Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private Sub InitializeComponent()
Me.Label6 = New System.Windows.Forms.Label
Me.Label5 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.btnDelete = New System.Windows.Forms.Button
Me.btnAdd = New System.Windows.Forms.Button
Me.btnLast = New System.Windows.Forms.Button
Me.btnNext = New System.Windows.Forms.Button
Me.btnPrev = New System.Windows.Forms.Button
Me.btnFirst = New System.Windows.Forms.Button
Me.txtZip = New System.Windows.Forms.TextBox
Me.txtState = New System.Windows.Forms.TextBox
Me.txtCity = New System.Windows.Forms.TextBox
Me.txtStreet = New System.Windows.Forms.TextBox
Me.txtLastName = New System.Windows.Forms.TextBox
Me.txtFirstName = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(176, 104)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(22, 13)
Me.Label6.TabIndex = 35
Me.Label6.Text = "Zip"
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(8, 104)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(32, 13)
Me.Label5.TabIndex = 34
Me.Label5.Text = "State"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(8, 80)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(24, 13)
Me.Label4.TabIndex = 33
Me.Label4.Text = "City"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(8, 56)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(35, 13)
Me.Label3.TabIndex = 32
Me.Label3.Text = "Street"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(8, 32)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(58, 13)
Me.Label2.TabIndex = 31
Me.Label2.Text = "Last Name"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(8, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(57, 13)
Me.Label1.TabIndex = 30
Me.Label1.Text = "First Name"
'
'btnDelete
'
Me.btnDelete.Location = New System.Drawing.Point(240, 144)
Me.btnDelete.Name = "btnDelete"
Me.btnDelete.Size = New System.Drawing.Size(32, 24)
Me.btnDelete.TabIndex = 29
Me.btnDelete.Text = "X"
'
'btnAdd
'
Me.btnAdd.Location = New System.Drawing.Point(200, 144)
Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(32, 24)
Me.btnAdd.TabIndex = 28
Me.btnAdd.Text = "+"
'
'btnLast
'
Me.btnLast.Location = New System.Drawing.Point(104, 144)
Me.btnLast.Name = "btnLast"
Me.btnLast.Size = New System.Drawing.Size(32, 24)
Me.btnLast.TabIndex = 27
Me.btnLast.Text = ">>"
'
'btnNext
'
Me.btnNext.Location = New System.Drawing.Point(72, 144)
Me.btnNext.Name = "btnNext"
Me.btnNext.Size = New System.Drawing.Size(32, 24)
Me.btnNext.TabIndex = 26
Me.btnNext.Text = ">"
'
'btnPrev
'
Me.btnPrev.Location = New System.Drawing.Point(40, 144)
Me.btnPrev.Name = "btnPrev"
Me.btnPrev.Size = New System.Drawing.Size(32, 24)
Me.btnPrev.TabIndex = 25
Me.btnPrev.Text = "<"
'
'btnFirst
'
Me.btnFirst.Location = New System.Drawing.Point(8, 144)
Me.btnFirst.Name = "btnFirst"
Me.btnFirst.Size = New System.Drawing.Size(32, 24)
Me.btnFirst.TabIndex = 24
Me.btnFirst.Text = "<<"
'
'txtZip
'
Me.txtZip.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtZip.Location = New System.Drawing.Point(200, 104)
Me.txtZip.Name = "txtZip"
Me.txtZip.Size = New System.Drawing.Size(72, 20)
Me.txtZip.TabIndex = 23
'
'txtState
'
Me.txtState.Location = New System.Drawing.Point(72, 104)
Me.txtState.Name = "txtState"
Me.txtState.Size = New System.Drawing.Size(32, 20)
Me.txtState.TabIndex = 22
'
'txtCity
'
Me.txtCity.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtCity.Location = New System.Drawing.Point(72, 80)
Me.txtCity.Name = "txtCity"
Me.txtCity.Size = New System.Drawing.Size(200, 20)
Me.txtCity.TabIndex = 21
'
'txtStreet
'
Me.txtStreet.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtStreet.Location = New System.Drawing.Point(72, 56)
Me.txtStreet.Name = "txtStreet"
Me.txtStreet.Size = New System.Drawing.Size(200, 20)
Me.txtStreet.TabIndex = 20
'
'txtLastName
'
Me.txtLastName.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtLastName.Location = New System.Drawing.Point(72, 32)
Me.txtLastName.Name = "txtLastName"
Me.txtLastName.Size = New System.Drawing.Size(200, 20)
Me.txtLastName.TabIndex = 19
'
'txtFirstName
'
Me.txtFirstName.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtFirstName.Location = New System.Drawing.Point(72, 8)
Me.txtFirstName.Name = "txtFirstName"
Me.txtFirstName.Size = New System.Drawing.Size(200, 20)
Me.txtFirstName.TabIndex = 18
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(278, 175)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.btnDelete)
Me.Controls.Add(Me.btnAdd)
Me.Controls.Add(Me.btnLast)
Me.Controls.Add(Me.btnNext)
Me.Controls.Add(Me.btnPrev)
Me.Controls.Add(Me.btnFirst)
Me.Controls.Add(Me.txtZip)
Me.Controls.Add(Me.txtState)
Me.Controls.Add(Me.txtCity)
Me.Controls.Add(Me.txtStreet)
Me.Controls.Add(Me.txtLastName)
Me.Controls.Add(Me.txtFirstName)
Me.Name = "Form1"
Me.Text = "UseCurrencyManager"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents btnDelete As System.Windows.Forms.Button
Friend WithEvents btnAdd As System.Windows.Forms.Button
Friend WithEvents btnLast As System.Windows.Forms.Button
Friend WithEvents btnNext As System.Windows.Forms.Button
Friend WithEvents btnPrev As System.Windows.Forms.Button
Friend WithEvents btnFirst As System.Windows.Forms.Button
Friend WithEvents txtZip As System.Windows.Forms.TextBox
Friend WithEvents txtState As System.Windows.Forms.TextBox
Friend WithEvents txtCity As System.Windows.Forms.TextBox
Friend WithEvents txtStreet As System.Windows.Forms.TextBox
Friend WithEvents txtLastName As System.Windows.Forms.TextBox
Friend WithEvents txtFirstName As System.Windows.Forms.TextBox
End Class
Subscribe to:
Posts (Atom)