Solved

C# Windows app - Current Changed not working

Posted on 2011-09-26
5
307 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
  • 3
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
Carlos Villegas earned 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DateTimepicker 4 38
Run time Error 4 47
System.Speech 2 26
How to catch the result of a javascript confirm dialog box, for a C# onclick event 4 59
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 I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 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

6 Experts available now in Live!

Get 1:1 Help Now