Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here is my code

if (e.KeyChar == 13)
              panel4.Enabled = false;
           if (dataGridView1.CurrentCell.ColumnIndex == 0)
                    cmb.SelectedIndexChanged += new EventHandler(cmb_SelectedIndexChanged);
                    this.cmb.Location = this.dataGridView1.GetCellDisplayRectangle(0, rowindex, true).Location;

                    cmb.Visible = true;
                    cmb.SelectedIndexChanged += new EventHandler(cmb_SelectedIndexChanged);
                    dgvc = (DataGridViewCell)dataGridView1[dataGridView1.CurrentCell.ColumnIndex, dataGridView1.CurrentCell.RowIndex];
                    //dgvc.Value = cmb.SelectedText;

as user enter key press a combobx is popup but he is not able to move cursor on combobx display item ...can any buddy tell me how to move cursor ????????

thanks in advanced
Sridhar Patnayak 3-Feb-12 11:47am    
Where is your combobox code, above code not related to the question, please elaborate your question clearly.
[no name] 3-Feb-12 11:51am    
if (con.State == ConnectionState.Closed)

SqlCommand cmd = new SqlCommand("VAOUCHE_FRM", con);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.AddWithValue("@activityType", 2);
cmd.Parameters.AddWithValue("@ccodec", Compcls.Gcomp_cd);
SqlDataReader sdr = cmd.ExecuteReader();
DataTable dt = new DataTable();
cmb.DisplayMember = dt.Columns["NAME"].ColumnName;
cmb.ValueMember = dt.Columns["AC_CODE"].ColumnName;
cmb.SelectedIndex = 0;
[no name] 3-Feb-12 11:56am    
my combbox work properly but at first time arrow key not work for display item...but if we select item by mouse for first time is after than it works fine way.....
[no name] 3-Feb-12 12:07pm    
is there any buddy who can help me ..........

1 solution

The issue is that the control is not selected. Why are you checking the KeyChar instead of the Keys enum ? Your code seems very sloppy to me, for example, you set the SelectedIndexChanged event twice. You realise that the control will start with a selected index, and this won't fire until it changes ? Is that part of your issue ? If you have to set Visible to true at all, then you should do it before making the control selected, selecting an invisible control won't do anything.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900