?
Solved

vb.net 2012 datagridview

Posted on 2014-04-27
6
Medium Priority
?
503 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

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

Accepted Solution

by:
Ganapathi earned 2000 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

650 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