none
Excel dataset and bindingsource - error when hiding columns RRS feed

  • Question

  • Hi!

    I have an excel sheet with a data source. This works all right, except when I hide some columns in excel. In that case the hidden columns are simply skipped when updating the excel sheet from the data source and all the values end up in the wrong columns.

    Is there any way to fix that?

    Lots of Greetings!

    Volker

    Added: The problem happens, when Rows AND some columns are hidden.


    Volker


    • Edited by Hetzi Thursday, September 27, 2012 2:28 PM
    Thursday, September 27, 2012 2:17 PM

All replies

  • Hi Hetzi,

    Thanks for post in the MSDN Forum.

    Would you please clarify your Excel version and scenario for further trouble shooting?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, September 28, 2012 5:43 AM
    Moderator
  • Sorry for the delay, the Scenario is this:

    Environment:

    • Excel 2007 Document level customisation (.xltm)
    • Visual Studio 2010
    • c#, .NET 4.0
    • "Platform" in VS 2010 is set to x86
    • Deployment is on Win7/64

    How I created the program:

    • I create a typed dataset in the VS Designer
    • I create a project datasource based on that data set
    • I drag that data set onto a work sheet and am done.

    What I do:

    • User enters data
    • I get the row changed event from the data set.
    • I put the data into a database.
    • I read data from the database in case the values in some other columns have changed.
    • I write that data into the data set, that is, into the row the user has entered the data in and call Row.AcceptChanges(). (I'm still in the event handler, but have set a boolean variable so that no stack overflow happens.

    What happens:

    • User hides some columns
    • User uses Autofilter and some rows get hidden too.
    • The hidden rows get skipped when the data set writes back to the worksheet. Instead, the data gets written into the next visible column. Since the data set can't write outside the list object, the rightmost data fields "fall off", that is, dissappear, like in a left shift operation.

    I can post an example solution. Is this possible?

    Lots of Greetings!


    Volker

    Monday, October 1, 2012 9:34 AM
  • Hi Volker,

    Ok, please provide your snippet for further research. I think it will help us easier to approach the key of this issue.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 3, 2012 8:23 AM
    Moderator