Ninnad Jagtap
Active member
- Joined
- Apr 12, 2005
- Messages
- 35
- Programming Experience
- Beginner
Want to add controls to grid on run time . How do i do that i cannt access the
DataGridTextBox.TextBox.Controls.Add(a) property.
Here is the code that i have written
sqlConn.Open()
Dim sc As New SqlCommand()
sc.Connection = sqlConn
sc.CommandType = CommandType.Text
sc.CommandText = "Select * from Jobs"
Dim ds As New DataSet()
Dim da As New SqlDataAdapter(sc)
Dim comboControl = New ComboBox()
comboControl.Cursor = System.Windows.Forms.Cursors.Arrow
comboControl.dropdownstyle = System.Windows.Forms.ComboBoxStyle.DropDown
comboControl.Dock = DockStyle.Fill
comboControl.Items.AddRange(New String(5) {"", "A1", "A2", "A3", "A4", "A5"})
Dim dtp As New DateTimePicker()
dtp.Dock = DockStyle.Fill
dtp.Cursor = Cursors.Arrow
Dim chk As New CheckBox()
chk.Dock = DockStyle.Fill
chk.Cursor = Cursors.Arrow
Dim i As Integer
For i = 0 To (ds.Tables(0).Rows.Count) - 1
If DataGrid1(i, 0).ToString().Equals("1") Then
DataGridTextBox.TextBox.Controls.add(dtp)
End If
Next
DataGridTextBox.TextBox.Controls.Add(a) property.
Here is the code that i have written
sqlConn.Open()
Dim sc As New SqlCommand()
sc.Connection = sqlConn
sc.CommandType = CommandType.Text
sc.CommandText = "Select * from Jobs"
Dim ds As New DataSet()
Dim da As New SqlDataAdapter(sc)
Dim comboControl = New ComboBox()
comboControl.Cursor = System.Windows.Forms.Cursors.Arrow
comboControl.dropdownstyle = System.Windows.Forms.ComboBoxStyle.DropDown
comboControl.Dock = DockStyle.Fill
comboControl.Items.AddRange(New String(5) {"", "A1", "A2", "A3", "A4", "A5"})
Dim dtp As New DateTimePicker()
dtp.Dock = DockStyle.Fill
dtp.Cursor = Cursors.Arrow
Dim chk As New CheckBox()
chk.Dock = DockStyle.Fill
chk.Cursor = Cursors.Arrow
Dim i As Integer
For i = 0 To (ds.Tables(0).Rows.Count) - 1
If DataGrid1(i, 0).ToString().Equals("1") Then
DataGridTextBox.TextBox.Controls.add(dtp)
End If
Next