Click here to Skip to main content
15,905,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one textbox and dropdown in datagrid. if am entering the value field of the dropdown in textbox i want to select corresponding item in dropdown. how can i do this .can anyone help me? i need coding in vb.net c#
Posted
Updated 13-Mar-12 2:35am
v2

Hi,

here's a quick similar example code with textbox and ListBox.


C#
for (int i = 0; i <= listBox1.Items.Count; i++)
            {
                if (listBox1.Items[i].ToString() == textBox1.Text)
                {
                    listBox1.SelectedIndex = i;
                    break;
                }
            }


Should also work for you.

Best Regards
 
Share this answer
 
Comments
Aswathi Narayan 14-Mar-12 4:23am    
Thnks 4 ur reply.. I need coding for datagridview
Try this below method in the datagrid rowbound event or databound event according to your requirement.


VB
Private Sub textBox1_KeyUp(sender As Object, e As KeyEventArgs)
    If textBox1.Text <> String.Empty Then
        cmbFile.SelectedValue = textBox1.Text

        
    End If
End Sub
 
Share this answer
 
v2

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