Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8512527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:18:09+00:00 2026-06-11T04:18:09+00:00

Visual studio 2010 Express (Beginner) , I am using VB Currently attempting Datagridview, I

  • 0

Visual studio 2010 Express (Beginner) , I am using VB

Currently attempting Datagridview, I have 3 columns in my DGV – The 2nd column consists of a combobox cbo1 and 3rd column is a Textbox txt2. Column1 is the name of the person txt1

Country & Capital are the two columns in my ‘mysql database’

I have added my database to a dataset named ds using the adapter,

    adp.Fill(ds)
    Country_cbo.DataSource = ds
    cbo1.DisplayMember = ds.Columns("Country").ToString

Using the above code I have managed to populate the cbo1 with Countries name (using mysql database)

Trying to Achieve:
Upon selecting a value from country name function should fill the textbox with the capital of the respective country by looking into the Data set ( Which is my Database )

A guideline to acheive this would be highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:18:10+00:00Added an answer on June 11, 2026 at 4:18 am

    Assuming your dataset has only one table, So ds.Tables[0] will give you the table in dataset.

    Now the value is retrieved from the combo box as combobox.SelectedItem.

    Then you can use a for loop to traverse through all rows of the ds.Tables[0] .

    Compare the value of combo box with the column value in each row. If there is a match, retrieve the capital column’s value of that row

    Example for loop (C# syntax):

        foreach (DataRow r in ds.Tables[0].Rows)      
        {
            //Your logic here to perform comparison  
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Visual C# Studio 2010 Express and I have oakward problem. I
im writing an application using Visual Studio 2010 Express Edition. I have a problem
I am using visual studio 2010 Express. I have created a website in asp.net.It
Using Visual Studio 2010 Express I have a task list open and on filter
I have an app in c# using Visual Studio 2010 express and realized the
Visual Studio 2010 Express, Windows Forms. Have made myself my first little application which
I have developed the WCF web service in vb.net in visual studio 2010 express
I have built up the wcf web service in visual studio express 2010. I
I am using IIS Express in Visual Studio 2010 and right now it runs
using Visual.Web.Developer.2010.Express; using SQL.Server.Management.Studio.2008.R2; What I'm ultimately trying to do is update a sql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.