Many people have asked how to get screen width and height in vb.
The answers included using My.Computer.Screen.Bounds, Screen.PrimaryScreen.Bounds, System.Windows.SystemParameters.PrimaryScreenWidth, etc.
But for me, they all come back undefined.
One said I want the Screen class located at System.Windows.Forms.Screen. I added a reference to system.windows.forms. Didn't work. Is that something to import? That didn't work either.
Do I import something? Add a reference? Inherits?
And many solutions use javascript. It's easy to get screen width and height with javascript. But the timing is wrong. I want the screen size before I generate my VB code. But I have to put my javascript in an "onload=", which makes it run AFTER the VB code is generated.
The only way I've found is to let the javascript determine the dimensions, then redirect, passing these values as parms. And that's not bullet proof.
There must be a simpler way.
I've never found a COMPLETE example, including declarations, even on the microsoft pages, that works.
Thanks in advance.