Solved

vb.net 2012 datagridview

Posted on 2014-04-27
6
486 Views
Last Modified: 2014-04-27
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
Comment
Question by:dastaub
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:Ganapathi
ID: 40025592
Are you trying to call a EventHandler on clicking the column?
0
 

Author Comment

by:dastaub
ID: 40025715
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
 
LVL 8

Expert Comment

by:Ganapathi
ID: 40025740
Set the IsPostBack property to True on DataGridView in page_load and try it.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:dastaub
ID: 40025750
It is a windows form app not a web app
0
 
LVL 8

Accepted Solution

by:
Ganapathi earned 500 total points
ID: 40025809
Did you set the Enabled property of the DataGridView to True?
0
 
LVL 40
ID: 40025955
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question