Datagridview grouping?

afreen

Member
Joined
Feb 26, 2013
Messages
5
Programming Experience
1-3
Hi,
I have a table invoice whose fields are customer_name, invoice_id,total,balance .
invoiceid is the primary key whereas custoemer_name is the foreign key..

I have received table whose fields are payment_id, customer_name,date etc
and recieved_details table whose fields are payment_id(foreign k),invoice_no, amount

Now I want to group the invoice for each custoemr ...i want result something as customer balance details:

Shahrukh
Inv1 2000 1500
Payment1 500
Inv2 3000 3000

Salman
Inv3 1000 0
Inv6 500 500

where
custoemrnames =sharukh,salman
invoice id=inv1,inv2,inv3,inv4
total= 2000 ,3000,1000,500
balance-1500,3000,0,500

The basic structure should be
customer_name
invoiceid total balance

I need this in a vb.net windows application..after getting this result how can I display it ..in a grdivew ? or with someother control but how?

I want to generate something like "Customer Balance Details" report in quickbooks
 
A DataGridView displays a table and what you want is not just a simple table. You could use a ListView, which provides functionality to group and display columns, much as is done with your email in Outlook.
 
A DataGridView displays a table and what you want is not just a simple table. You could use a ListView, which provides functionality to group and display columns, much as is done with your email in Outlook.


Thank u so much for your reply...I thought it wont be possible with datagridview...i have never used listbox....and i googled it...but i didnt get any example which could give me idea to code it in my situation...If you dont mind can you help with some code idea...like how to do it...if not full code but atleast like some hints with code...

Thanks in advance
 
Googling for information about using a ListBox won't help much given that I said that you could use a ListView. The obvious first place to look is the documentation for the ListView class and, more specifically, its Groups property.
 
Googling for information about using a ListBox won't help much given that I said that you could use a ListView. The obvious first place to look is the documentation for the ListView class and, more specifically, its Groups property.

sorry that was a typing mistake ,,,i meant listview only
 
ok i think groups property will help me...but a question ...i also want that on clicking invoice no a form will open with details of that invoice id....so if im doing grouuping in listview..does it have cell click event ?


Thanks a lot for ur suggesting and sorry for typing mistake :)
 
I think you will be best served with a third party grid control, like DevExpress XtraGrid or Janus GridEx, at least until Microsoft decides to provide us with a useful (for anyone doing anything more than very basic data processing) grid control. They all support things like grouping headers and drill downs. Otherwise you have to implement it all yourself.
 
i also want that on clicking invoice no a form will open with details of that invoice id....so if im doing grouuping in listview..does it have cell click event ?
ListView has a MouseDown event and a HitTest method that can give you this info.
 
Thanks Herman and john for ur reply,,,

let me try to create my own control and lets see till where i go...but surely i will post whatever solution i get....:)
 
Back
Top