DataGridView

இந்த பாடம் DataGridView கட்டுப்பாட்டை விவரிக்கிறது.
DataGridView
DataSet அல்லது BindingSource போன்ற தரவு மூலத்திலிருந்து தரவு வரும்போது இந்த கட்டுப்பாடு ஒரு அட்டவணை-போன்ற  காட்சி காட்டப்படுகிறது.

DataGridView தோற்றத்தை தனிப்பயனாக்க பல பண்புகள் வழங்குகிறது.
உதாரணமாக, நீங்கள்  rows and columns என்பதை தீர்மானிக்கமுடியும்.

Add New Data Sourceவகை தரவுத்தளத்தைத் தேர்ந்தெடுக்கவும்:
data source
Click next so you can select the data you want to retrieve:

data source objects

Now just drag and drop the table to the form:

data source table

Voila!

test

Note: you could do the very same with the code below:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Dim table As New DataTable
Dim connection As New SqlConnection(My.Settings.ConnectionString)
Try
    connection.Open()
    Dim command As SqlCommand = connection.CreateCommand
    command.CommandText = "SELECT * FROM Students"
    table.Load(command.ExecuteReader)
    command.Dispose()
    StudentsGrid.DataSource = table
Catch ex As Exception
    MessageBox.Show(ex.Message)
Finally
    connection.Close()
End Try

No comments:

Post a Comment

Pages