C
cj
I need to make all but 2 of the columns in the datagridview readonly.
Can I do this? How? Below is my code.
Dim MySqlConnection As New SqlClient.SqlConnection
Dim MySqlCommand As New SqlClient.SqlCommand
Dim MySqlAdapter As New SqlClient.SqlDataAdapter
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MySqlConnection.ConnectionString = "packet size=4096;user ....."
If ShowPostedToolStripMenuItem.Checked Then
MySqlCommand.CommandText = "select * from Checks"
Else
MySqlCommand.CommandText = "select * from Checks where Post
= 0"
End If
MySqlCommand.Connection = MySqlConnection
MySqlAdapter.SelectCommand = MySqlCommand
DataGridView1.DataSource = mydt
mydt.Clear()
mydt.Columns.Clear()
Try
MySqlAdapter.Fill(mydt)
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
Exit Sub
End Try
End Sub
Can I do this? How? Below is my code.
Dim MySqlConnection As New SqlClient.SqlConnection
Dim MySqlCommand As New SqlClient.SqlCommand
Dim MySqlAdapter As New SqlClient.SqlDataAdapter
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MySqlConnection.ConnectionString = "packet size=4096;user ....."
If ShowPostedToolStripMenuItem.Checked Then
MySqlCommand.CommandText = "select * from Checks"
Else
MySqlCommand.CommandText = "select * from Checks where Post
= 0"
End If
MySqlCommand.Connection = MySqlConnection
MySqlAdapter.SelectCommand = MySqlCommand
DataGridView1.DataSource = mydt
mydt.Clear()
mydt.Columns.Clear()
Try
MySqlAdapter.Fill(mydt)
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
Exit Sub
End Try
End Sub