Datagridview is all black on form load - vb.net

I am using VB.Net is Visual Studio v16.6.3
I started getting this problem a few days ago on an application I developed two years ago and have been improving on and off. This error appeared out of now where. My DataGridView is OK at design time. when I launch the application, all forms that contain a DataGridView, it will appear all blacked out - as per image below.
If I minimize the form and return to it, the datagridview is fine, as per image below:
I get the same problem, in design mode or on a compiled executable. I have not tried this on some elses computer yet to see if it is graphics-card related or application related. Anyone has any idea how to resolve it? I did notice that if I move the datagrid binding and display from the "new" contructor to the "shown" event, it sometimes fixes the problem - but not always. Very weird and random.

I finally found it. I have to call the Refresh for my datagridview... I don't know why. Did not have to do that before but it works.
If someone can explain the reason behind this behavior, please tell me.

Related

Trying to open code for a control/form brings up Form Designer code

I used to program in VB6 professionally (up to about 6 years ago). Now I'm trying to write a personal program in Visual Studio 2017 Community. I'm having a problem:
I had the program finished but needed to embed an ICO file in the EXE and couldn't get it to work. Somewhere in the process, I screwed something up. None of my "code-behind" stuff is running. That is, form_load doesn't run, none of the code associated with the buttons runs when clicked upon, nothing. Double-clicking a button to see the code behind it actually brings up the Form1.Designer.vb window (which I'd not seen before).
It's as if all the code behind the form has been orphaned and the form and the code which had been associated with it have been separated. I'm sure I did something stupid while monkeying with settings to try to get the ICO file to embed but I have no clue what I did wrong.
Suggestions? Please. :-/
--HC

ShowFileDialog1 Freezing

Okay, I have had the most aggravating problem with OpenFileDialog1. I have a program that I've been using for some 8 months, and in the past month, the program has begun to hang randomly when utilizing the OpenFileDialog1.ShowDialog() function. I have already read through all of the other posts about multi-threaded vs single threaded application. This did not fix it. Enabling the "Show Help" button did not fix it. I am mostly at a loss. here is a thorough walkthrough of the bug:
Run the application. I can always use the Open File button a few times with no problems. It freezes randomly after the program has been running for awhile.
The freeze happens after I push the ShowDialog button, and never displays the Open File Dialog window. The entire program locks up and hangs. If I pause it, Visual Studio doesn't show an error. It underlines the OpenFileDialog1.ShowDialog() in green, which is very odd.
I have found a way to break the freeze. Simply run a second instance of the program and use the OpenFileDialog function. As soon as it loads the file in the second instance, the first instance unfreezes. However, this is not a fix.
The only thing I can think of that may be causing this is the program also uses a WebBrowser1 control. It only seems to happen AFTER the WebBrowser control, which is on a seperate form, not the main form, has been initiated and utilized. Does this make any sense at all?
Thank you for anyone who can help me. I am about to tear my hair out.
Debug your program with dnspy, And when the software freezes, you will be able to see within the dnspy the actual code even if it is in a third party DLL.
I have solved this problem. It was quite unsolveable based on my description above, but hopefully I will help someone with this solution. The error is related to using the IE11 Emulation Control (11000) in the WebBrowser1 control. For some reason this interferes with OpenFileDialog and causes it to hang. I have no idea why. I changed my WebBrowser1 to use IE9 Emulation Control (9999) and the error has gone away. Thank you to those who looked into this. This is a registry entry in HKEY_CURRENT_USER.

Form designer only shows the form in vb.net

I was working at the forms designer and yesterday the designer literally only showed the form. Tried copying the .designer.vb to another new form and the same thing happened. Also when built it just shows what the designer shows. Compare the two versions:
(Had to use pastebin as the code is too long for a post, and it rejects my post if more than two links are used.)
Current code: pastebin.com/SsgR7YWD
Current form view:
Previous code: pastebin.com/bXCL3jhH
Previous screenshot:
Why it is not showing the controls? I know it is a long piece of designer code but I can't find where the error comes from.
I've just run your code through this site that compares to blocks of text and shows the differences - there's a lot - you might want to do the same and have a look at the differences. It may be easier to delete the form and start again to be honest. Having said that, you might be able to spot what went wrong
You should just delete the form and start again. A few tips to having a better UI ---
Use layout grids for the button-checkboxes and let the buttons occupy the whole horizontal space.
And remember to backup your code often so that things like this won't happen again - use something like GitHub and commit your files whenever your day is finished.
Happy coding!

Member <> is not recognized or is not accessible, while F12 brings me to the definition

To get a head start on a new UWP project, I copy a sample (NavigationMenu from https://github.com/Microsoft/Windows-universal-samples.git) into my own project, learning in the same time.
I am being very careful, and everything looks OK. But I get the above error a few times, while I can jump to the unrecognized member with F12 or actually have intellisense finding that member while typing in XAML.
I am at a lost about what to do to solve this, as I don't see what to "fix".
Is there any way to "debug" XAML in design time?
Thanks for your help!
Bernard
Solved!
The least that I can say is that the errors triggered had NOTHING to do with the real cause!
For whatever reason, I opened the project in Blend. There I saw that I had inadvertently created a click event on a list item (in XAML), so it was not handled in code behind. I just deleted that click event, and everything finally compiled!
Lost quite a bunch of time chasing for false errors in Visual Studio...
If it may help someone else.....

Visual Studio Express 2015. Changes in form does not apply on debug

I just had a really weird thing happening on the application I'm developing.
Everything was doing well until, suddenly, I can't do any change on my form.
If I modify something in my form, a button text for example, it appears with the new name in the designer but if I start the application it runs with the previous version of the text in the button. I tried modifying a lot of things, position, text, color, really messing up my design but when I start it I don't see any change... I even tried to change things from the code (change button text on form load) but still no change... I try shutting down and restart the PC, no better luck...
I probably have touched something somewhere that cause this problem but I do not know what and this turns me nuts...
Other apps I made before are still running perfectly and running with new content if I edit their design form.
Any ideas ?
Thanks a lot.
Vince