Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

C# Windows app - Current Changed not working

Posted on 2011-09-26
5
Medium Priority
?
329 Views
Last Modified: 2012-05-12
I am trying to populate a second data grid when the user
moves from one  row of the first grid to another row.  I tried
 using the binding source current changed thinking that this
will give me the correct data especially when the user sorts
the data.  This is what I did:
     
        void m_srcBillingAudit_CurrentChanged(object sender, EventArgs e)
        {
           
            this.dgvDaysatPatient.DataSource = null;
            DataRowView rowView = (DataRowView)this.m_srcBillingAudit.Current;
            if (rowView == null)
                return;
           
                m_dtAssets = m_Assets.FillAsset_RentalLogEndDate(rowView["MRN"].ToString(),
                Convert.ToInt32(rowView["NO"].ToString()));
            dgvDaysatPatient.DataSource = m_dtAssets;
            int sumDaysP = 0;
     }
How should I go about obtaining the row a user is now looking
at so I can properly populate the second grid?
0
Comment
Question by:LenTompkins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
Carlos Villegas earned 2000 total points
ID: 36599364
Hello, that code looks fine and should do the job, just be sure that your Master DataGridView has it DataSource set to m_srcBillingAudit
0
 

Author Comment

by:LenTompkins
ID: 36599504
When the user presses a button to populate the master grid this is how I have it coded, but it
didn't help:
            m_srcBillingAudit.DataSource = m_dtBillingAudit;
            navPatients.BindingSource = m_srcBillingAudit;
            dgvPatientstoReview.DataSource = m_srcBillingAudit.DataSource;

Is this correct?
0
 

Author Comment

by:LenTompkins
ID: 36599525
Thanks I figured it out.  My Populate master grid should have looked like this:
m_srcBillingAudit.DataSource = m_dtBillingAudit;
            navPatients.BindingSource = m_srcBillingAudit;
            dgvPatientstoReview.DataSource = m_srcBillingAudit;
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 36599534
There is the problem, try:
dgvPatientstoReview.DataSource = m_srcBillingAudit;

Open in new window

I'm assuming that m_srcBillingAudit is a BindingSource Object
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 36599540
Good! have a nice day
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 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