By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,885 Members | 1,445 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,885 IT Pros & Developers. It's quick & easy.

how to emmbed combobox in particular Cell in vb.net

donilourdu
P: 53
hi every one.

I am doing project that holds Datagrid. I need a datagrid that can act as a combobox and Datetimepicker in seperate cells (Not in colums or Rows). I can able to create colum wise combobox.

But I need a program that create combobox of particular cell. aswell date time picker. Plz resolve my issue


with regrds
Doni
Feb 6 '07 #1
Share this Question
Share on Google+
5 Replies


kenobewan
Expert 2.5K+
P: 4,871
I don't understand your question... you want these objects in cells that are not part of any column or row of the datagrid?
Feb 7 '07 #2

donilourdu
P: 53
hi thank you for your reply. I want code for cobobox object in partcular cell.
example
In datagridview

cell location (0,2) has combobox component with items 1,2,3....
cell location (0,3) has datetimepicker componet
.

Need code for above. But I know how to create combobox in paricular colum or row.

Plz guide me to solve this.

with regards,
Doni.





I don't understand your question... you want these objects in cells that are not part of any column or row of the datagrid?
Feb 7 '07 #3

kenobewan
Expert 2.5K+
P: 4,871
Create a DataGrid Cell object and make it the current cell:
Expand|Select|Wrap|Line Numbers
  1. DataGridCell dgcell = new DataGridCell(0,2);
  2. dgData.CurrentCell = dgcell;
Then see if you can apply what you know about adding comboboxes...

Hope that this helps.
Feb 7 '07 #4

donilourdu
P: 53
thank you very much. Now I can able to add combobox in particular cell with following Vb.Net Code for your reference. I think you gave code in c#.

Code:

Public Class mycombo

Inherits DataGridViewComboBoxCell

Public WithEvents ColumnComboBox As ComboBox

Public Sub New()
ColumnComboBox = New ComboBox
End Sub

End Class

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s, s1 As New mycombo
s.Items.Add("INFORM")
s.Items.Add("PERMANENT")
DataGridView1.ColumnCount = 3
DataGridView1.RowCount = 5
Me.DataGridView1.Item(1, 2) = s
Me.DataGridView1.Item(1, 3) = s1
End Sub


But I am still having problem in adding datetimepicker in particular cell.If possible give me solution


with regards
Doni


Create a DataGrid Cell object and make it the current cell:
Expand|Select|Wrap|Line Numbers
  1. DataGridCell dgcell = new DataGridCell(0,2);
  2. dgData.CurrentCell = dgcell;
Then see if you can apply what you know about adding comboboxes...

Hope that this helps.
Feb 8 '07 #5

kenobewan
Expert 2.5K+
P: 4,871
What error do you get?
Feb 8 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.