The thing i want to do is in a datagrid there should be a combo box on the selection of which the other columns should
be filled.
The code so far i tried is
as follows
CODE
Dim ConString As String
ConString = "Data Source=Ankita; Initial Catalog=Ankita; Integrated Security=True"
Dim conn As New SqlConnection(ConString)
Dim ds As New DataSet
Dim ItemCode As New DataGridViewComboBoxColumn
ItemCode.DataPropertyName = "ItemCode"
ItemCode.Name = "ItemCode"
ItemCode.Items.AddRange("C", "E", "M")
Dim str As String
str = "Select ItemDescription, ItemQuantity, ItemRate from ItemDetails"
Dim da As New SqlDataAdapter(str, conn)
da.Fill(ds, "ItemDetails")
dgvItemDetails.DataSource = ds
dgvItemDetails.DataMember = "ItemDetails"
Me.dgvItemDetails.Columns.Add(ItemCode)
dgvItemDetails.Columns("ItemCode").Width = 40
This gives me a combo box but there is much more to be done in which i want help.
Firstly, i am able create a new column having combo box but it appears at the end of the other columns which i dont
want i want it to appear as the 1st column. can some one help me in this.
Secondly, i want only the column names appear in the grid from the sql database and not its rows till i select it from the
combo.
How can i do this please help.