Populating controls from selecting a row in a DataGrid

Posted on 2004-11-15
Last Modified: 2010-04-17
Hey there everyone,

I'm a newbie to VisualStudio.NET so I'm still struggling my way though it.

I am busy with a project and have a DataGrid that is populated with a list of names (I have created the Connection, Adapter & DataSet to do this and have the correct Data Members & Data Source selected)

What I want to do is have the controls on my form populated when I select a name from the datagrid.

What I have done is create a button (to test of course) that would load the data, however I am stuck on how I specify the row to be used in the datagrid (grdEmpList). I have this that loads all the controls but only with the first entry in the db.

    Private Sub butLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butLoad.Click
    End Sub

Question by:Craig_Muckleston
    1 Comment
    LVL 25

    Accepted Solution

    Hi craiq, just bind your controls to the same datasource as your datagrid, then it will fill the controls automatically when you select a row or cell from the datagrid

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    format the code in java 6 60
    either24  challenge 19 73
    Batch file output 20 71
    Replace a tag with sed 2 30
    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    A short article about problems I had with the new location API and permissions in Marshmallow
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now