CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2006
    Posts
    7

    how do i search a value using combo box in vb.net

    i am using dotnet 2003.i am doing my project in vb.net windows application.i have two form in my project.first form is datagrid .In second form label,textboxes and combobox are avilable to save the entering values in datagrid of first form through this 2nd form.my problem is,i want to search a value using combobox.
    for example,
    in first form,
    there are 4 columns named as name,age,rollno,address in datagrid.
    values are ramu for namecolumn,24 for age column,42 for rollno column,cbe for address column.now values in datagrid like below
    id name age rollno address
    1 ramu 24 42 cbe
    2 somu 23 32 che
    here id is primary key.
    in 2nd form,there are 4 label,4 textbox and 1 combobox.textbox arenamed as nametextbox,agetextbox,rollnotextbox,addresstextbox and 1 combobox named as searchcombobox.
    now values of name(ramu,somu) are stored in combobox.
    my problem is,
    in second form,
    if i click the value ramu in combobox means,want to display the values of ramu in textboxes.(ie..want to display automatically ramu in nametextbox,24 in age textbox,42 in rollnotextbox,cbe in address textbox)
    during runtime in vb.net windows application.so how i automatically display the values of row in each textbox by clicking the values in combobox.plz help me.

  2. #2
    Join Date
    Oct 2005
    Location
    Islamabad, Pakistan
    Posts
    1,277

    Re: how do i search a value using combo box in vb.net

    Just bind the controls to the dataTable filled from database
    Code:
            ComboBox1.DisplayMember = "Name"
            ComboBox1.DataSource = dt
    
            TextBox1.DataBindings.Add("text", dt, "Rollno")
            TextBox2.DataBindings.Add("text", dt, "Address")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured