[vb.net] how to get/find specific data from dgv and output this?
Dear friends,
Software working with: Visual Basic Express 2013
What do i want to make? An qoutation which shows the products and services.
At first, what do i have?
2 unbounded Dgvs
An table for products, for services and costumers.
The qoutation form which got 2 tabs in it, in each tab 1 unbounded dgv for the added products and services.
But then my problem,
I want to send these unbounded Dgvs to excel,
And without any sorting that is working.
But, in my products i have categories per product
For example:
2 t-shirts which got an category clothes
1 pair of shoes which got an category footwear
How is it possible to display Those 3 products in excel seperated and sorted per category?
Such as:
Clothing
2x t-shirt
Footwear
Shoes
I hope someone got the answer to this. If more information needed, let me know.
Gr,
Jaspertje
Re: [vb.net] how to get/find specific data from dgv and output this?
if you are populating the dgv from a database table, you can do a SQL query on the table then use copyfromrecordset into excel
Re: [vb.net] how to get/find specific data from dgv and output this?
Quote:
Originally Posted by
westconn1
if you are populating the dgv from a database table, you can do a SQL query on the table then use copyfromrecordset into excel
Hey Pete,
yes i'm populating the dgv with an Access Db. So i don't know if SQL is working with that. I've been searching on google for the solution but i couldn't find it.
Is it possible that the 2 unbounded datagridviews should get bounded with a query made in Access? And than with the copyfromrecordset to excel? Or is that bullsh*t?
Re: [vb.net] how to get/find specific data from dgv and output this?
yes you can use SQL to create a sorted and /or criteria based result from the table, then populate the dgv or excel from the recordset
something like
Code:
sql = "select * from tablename order by category"
rs = dbconnection.openrecordset(sql)
i never use bound controls, you can search on "why bounded controls are evil" then decide for your self
Re: [vb.net] how to get/find specific data from dgv and output this?
Quote:
Originally Posted by
westconn1
yes you can use SQL to create a sorted and /or criteria based result from the table, then populate the dgv or excel from the recordset
something like
Code:
sql = "select * from tablename order by category"
rs = dbconnection.openrecordset(sql)
i never use bound controls, you can search on "why bounded controls are evil" then decide for your self
Well ok! I will check that later, thanks for your comments.
Should catch some sleep now.
Re: [vb.net] how to get/find specific data from dgv and output this?
The data binding is evil argument really only applies to VB6. Data binding really was rubbish in VB6 but the worst issues were resolved with .Net, which you are using, so you can now use Databinding with confidence. It's certainly not applicable to every situation but it's a perfectly valid approach for 99% of them.