none
Shrinking Form

    Question

  • I posted this problem here VB forum .

    Visual Studio 2017 15.6

    Windows 10

    Created a new Visual Basic windows forms project. One Form with one Button.

    Dim strCon As String = $"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={strFileName};Extended Properties=""Excel 12.0;HDR=YES;"""
    Dim cn = New OleDbConnection(strCon)
    cn.Open()

    As soon as I click the button the form shrinks. Not minimized just smaller. This is all the code in the project. (except the path and file name .xlsx assigned to strFileName)

    I think I had the same problem in a project targeting an Access database. So now I am guessing it has something to do with Ace OLE Db provider.

    Any thoughts?


    Mary

    Wednesday, March 7, 2018 12:10 PM

Answers

  • Interesting. Are you using the 32-bit or 64-bit ACE OLEDB Provider?

    Paul ~~~~ Microsoft MVP (Visual Basic)

    • Marked as answer by Mary OB Sunday, March 11, 2018 3:03 AM
    Friday, March 9, 2018 3:00 PM

All replies

  • There is nothing in the code you posted that would cause the Form to shrink. Can you post a screen shot of before and after?

    Are you using the FlowLayoutPanel control or using AutoSize at all? Is there any code in the Form other than what you posted?


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, March 7, 2018 10:15 PM
  • Darn, I have the images but it only allows up to 1024 kb and these are 2 and 3 MB. It just shows the original form obscuring most of the desktop and then the form after the click much smaller with much more of the desktop exposed. BTW, I remembered that I had the same problem with Ace provider on an app targeting Access rather than Excel. I gave up on that one and targeted SQL Server instead.

    Mary

    Thursday, March 8, 2018 6:26 AM
  • No panels, no other code but what I posted. No anchors. Just a form and a button. I suspect the Ace provider.

    Mary

    Thursday, March 8, 2018 6:28 AM
  • Hi Mary OB,

    Based on your description and related code, I could not find any issue, you create a connection instance, which connect to your excel file and open it.

    it will be beneficial to resolve the issue if you create and share a simple demo via Onedrive, which could reproduce the issue.

    Note: please remove privacy information before you upload to OneDrive.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 8, 2018 6:57 AM
    Moderator
  • Shrinking Form Project Here is the link. never did this before. I hope it works.


    Mary

    Thursday, March 8, 2018 9:03 AM
  • No panels, no other code but what I posted. No anchors. Just a form and a button. I suspect the Ace provider.

    Mary

    I didn't encounter any change in the Form size when I clicked on the button. What happens if you comment all the code, run the app and then click the button? Does the Form still change size?


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, March 9, 2018 12:00 AM
  • Commented everything out and clicked the button. No change. No shrinkage.

    Mary

    Friday, March 9, 2018 3:44 AM
  • Commented everything out and clicked the button. No change. No shrinkage.

    Mary


    So if you step through the code in Debug is there a specific line that causes it to shrink, or does it shrink after all the code has executed and the click event has completed executing?

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Friday, March 9, 2018 4:22 AM
  • Yes, cn.Open()

    Mary

    Friday, March 9, 2018 7:41 AM
  • I discovered a windows Information Event in Event viewer that happened at the same time as I clicked the button. Tried it twice and got the same result. Here are the details.

    Event 1001 Windows Error Reporting

    125730739576
    5
    PerfWatsonVS12Data
    Not available
    2105785163248591310
    PerfWatsonTcdb

     

    Mary

    Friday, March 9, 2018 9:40 AM
  • Interesting. Are you using the 32-bit or 64-bit ACE OLEDB Provider?

    Paul ~~~~ Microsoft MVP (Visual Basic)

    • Marked as answer by Mary OB Sunday, March 11, 2018 3:03 AM
    Friday, March 9, 2018 3:00 PM
  • Well, I am not sure how to tell. I have 64 bit office. When I checked the compile tab in project properties, I noticed that the Prefer 32 bit check box was checked. Apparently, this is checked by default. I unchecked it and got an error when I ran the program. The old favorite - Ace is not registered on this machine. I rechecked the box and no error but my shrinking problem. This would make me guess that it was 32 bit.

    Mary

    Saturday, March 10, 2018 2:51 AM
  • Paul, that was it! Thank you. I uninstalled the 32 bit provider and installed the 64 bit. Unchecked the prefer 32 bit check box. And, Bob's your uncle! No, shrinkage. Thank you very much.

    Mary

    Sunday, March 11, 2018 3:03 AM