[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 511
  • Last Modified:

vb.net 2012 datagridview

The below code creates a column in a datagridview control in visual studio 2012 using vb.net.  The column does not respond to being clicked?  Is there additional code to have the column respond to being clicked?

            Dim cmb As New DataGridViewComboBoxColumn()
            cmb.HeaderText = "aSelectData"
            cmb.Name = "cmb"
            cmb.MaxDropDownItems = 2
            cmb.Items.Add("True")
            cmb.Items.Add("False")
            DataGridView1.Columns.Add(cmb)
0
dastaub
Asked:
dastaub
  • 3
  • 2
1 Solution
 
GanapathiFacets DeveloperCommented:
Are you trying to call a EventHandler on clicking the column?
0
 
dastaubAuthor Commented:
I am trying to get the drop down list to display when I click on the column.  currently the drop down box does not respond to any click.
0
 
GanapathiFacets DeveloperCommented:
Set the IsPostBack property to True on DataGridView in page_load and try it.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
dastaubAuthor Commented:
It is a windows form app not a web app
0
 
GanapathiFacets DeveloperCommented:
Did you set the Enabled property of the DataGridView to True?
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
There is a reaction when you click on a DataGridViewComboBoxColumn. It might simply be that this is not the one that you expect.

The first click selects the cell.
A second one triggers the dropdown.

This makes sense. Users might want to simply click in the row without necessarily seeing the content of the list. Or they might simply want to copy and paste the information that is there.

Maybe you would prefer it to open on the first click, but other users would find it annoying. In my opinion, same as for any application, it's simply question of know it and it becomes an habit.

This is a common mechanism in Windows. In Windows Explorer, a first click on a file name selects it, a second one triggers a rename.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now