Re: Sorting dataset

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Jeff,

Need small help
I have datatable which contain A1, Z1, D1, X1 and M1 column
want to sort them in asc like A1, D1, M1, X1 and Z1

Milan

Jeff Wharton (donotspam) wrote:
Hi Andy,

The CF implementation is the same as the full framework.

I created a DS and bound it to a Grid Control. I then used the exact lines
of code you posted to create a DV and bound it to a second Grid Control.
Both Grids were sorted correctly.

Without knowing details about the structure of your DS or how you are
printing the invoice, all I can offer is the following:

1) Is the code column a System.String but you are storing numeric values in
the column. if so, the numbers 1 to 10 would print out as 1, 10, 2, 3, 4
giving the impresion that the data is not being sorted.

2) What are you using to print the invoice? If it is the same Grid control
used for displaying the invoice (i.e. the one bound to the original DS), you
need to assign your DV as the DataSource of the Grid before you print. Just
creating the DV and not assigning it will not sort the data.

Chief Solutions Architect
Australian Special Information Systems (ASIS)
(MSysDev, MCT, MCPD: Win, MCITP: DBD, MCSD.NET, MCP: SQL Server 2000, MACS
PCP)
Blog: http://whartonj.blogspot.com


"Andy Baker" wrote:

I have an invoicing application written in VB.NET 2003. The current invoice
is stored in a dataset, called DSInvoice, containing code, description,
quantity and price fields. It is bound to a datagrid to display it on
screen. I want to display the invoice lines on screen in the order in which
they are added, but when I print the invoice I want to print them in stock
code order. I am trying to use a DataView to do this, but cannot get it to
work. The code that I am using is:
Dim DVinvoice As DataView
DVInvoice = New DataView(DSInvoice.Tables("Details"))
DVInvoice.Sort = "Code ASC"
but this has no effect on the sort order of the DataView, it remains in the
same order as the original dataset. Is it something that I am doing wrong,
or does it need to be done differently with the Compact Framework? Thanks in
advance.

Andy Baker




.



Relevant Pages

  • Re: Business objects, subset of collection
    ... A Vendor grid showing a summary view of each vendor (with total Due, ... An Invoice grid listing all invoices for the selected vendor ... A Payment grid listing all payments scheduled for the selected ...
    (comp.object)
  • Re: Business objects, subset of collection
    ... A Vendor grid showing a summary view of each vendor (with total Due, ... An Invoice grid listing all invoices for the selected vendor ... A Payment grid listing all payments scheduled for the selected ...
    (comp.object)
  • Re: Business objects, subset of collection
    ... The app is for scheduling payments of invoices and has three grids ... A Vendor grid showing a summary view of each vendor (with total Due, ... An Invoice grid listing all invoices for the selected vendor ...
    (comp.object)
  • Re: Business objects, subset of collection
    ... The app is for scheduling payments of invoices and has three grids ... A Vendor grid showing a summary view of each vendor (with total Due, ... An Invoice grid listing all invoices for the selected vendor ...
    (comp.object)
  • Re: Project update: the Petrolia & Erie
    ... Two 2 x 4 grid sections have been completed. ... carefully used thin long nails and wood glue to build the framework; ... I laid sheets of 1/4" luan plywood on the framework. ... used on the outside of the layout. ...
    (rec.models.railroad)