1 Replies - 8868 Views - Last Post: 21 April 2011 - 07:07 AM Rate Topic: -----

#1 visweswaran28  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 45
  • Joined: 29-October 09

set selected value in datagridview combobox column

Posted 21 April 2011 - 06:01 AM

Hi,



I am having datagridview in that I have datagridview combobox column and noraml textfield. I want to know that how can I load selected value in that combox box when I am loading all entered details in data grid view.
Is This A Good Question/Topic? 0
  • +

Replies To: set selected value in datagridview combobox column

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9201
  • View blog
  • Posts: 34,575
  • Joined: 12-June 08

Re: set selected value in datagridview combobox column

Posted 21 April 2011 - 07:07 AM

I am not totally certain how you are "loading all entered details in data grid view", but if you want a quick and dirty method of shoving data into a cell that's a grid-combobox here you go! When in doubt - cast that thing!

FYI: column1 is my DataGridViewComboBoxColumn

    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Me.DataGridView1.Rows.Add()

        CType(Me.DataGridView1.Rows(0).Cells("column1"), DataGridViewComboBoxCell).Items.Add("aaa")
        CType(Me.DataGridView1.Rows(0).Cells("column1"), DataGridViewComboBoxCell).Items.Add("bb")
        CType(Me.DataGridView1.Rows(0).Cells("column1"), DataGridViewComboBoxCell).Items.Add("c")

    End Sub



Now you can go off and databind to that column, but that's a fairly involved process.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1