I have added checkboxes to datagridview dynamicaly in vb.net 2005
Like…….
- Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
Try
-
Dim rb As New RadioButton
-
con.ConnectionString = "Server= harika;uid=sa; initial catalog=superlynx"
-
con.Open()
-
cmd.CommandText = "select * from reports"
-
cmd.Connection = con
-
cmd.CommandType = CommandType.Text
-
Call populategrid()
-
Catch ex As Exception
-
MsgBox("Load" & ex.Message)
-
Finally
-
con.Close()
-
End Try
-
End Sub
-
Private Sub populategrid()
-
Dim dtcCheck As New DataColumn("Select")
-
dtcCheck.DataType = System.Type.GetType("System.Boolean")
-
dtcCheck.DefaultValue = False
-
adpt = New SqlDataAdapter("SELECT * FROM reports", con)
-
ds = New DataSet
-
adpt.Fill(ds, "reports")
-
'dvEmp = New DataView
-
'dvEmp.Table = dsEmp.Tables(0)
-
dt = New DataTable
-
dt = ds.Tables("reports")
-
dt.Columns.Add(dtcCheck)
-
DataGridView1.DataSource = dt
-
-
-
End Sub
O/p is:
If I check those checkboxes how can I get the (rep_no,rep_name) values for each row into crystal report
i.e., how the selected values can be appeared in the crystal report header as columns……..