Results 1 to 23 of 23

Thread: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2019
    Posts
    2

    Question DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with VB6

    I recently purvchased an NEC PA27Q. The default recommended display resolution is 2560 x 1440.
    I have one program that was made with VB6 that is now giving a run time error 6 (overflow) only at this resolution. When I change to any lower resolutions the program opens and functions normally. Is there a reason why? Can anything be done to rectify this other than reducing the display resolution each time I want to open said program?

  2. #2
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,751

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    If you have the source code for the VB6 program, we can probably determine what is causing the error and fix it. It is probably using some parameter from the screen resolution in a calculation where it does not expect a value that large to ever be found, resulting in an overflow error.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2019
    Posts
    2

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    I'll get back to you on this. :-) I'll send an email to the person responsible. I'll be back when I hear from him

    Much Thanks. :-)

  4. #4
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,250

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    You may have to change your form's scalemode to pixels.
    I believe there is a limit on some drawing related attributes that limit the property to 32,767 (i.e. the maximum positive value of an Integer).
    Assuming you're twipsPerPixel value may be something like 15, then (15 * 2560) = 38,400 which exceeds the 32K limit.
    If you set the form's scalemode to pixels, then the size of other controls on the form will be in pixels rather than twips so may avoid the issue.

    That is a guess, so I would give it a try since it is a simple thing to test.

  5. #5
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,571

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Hmmm, I've got three monitors on my system, which allows me to make very wide forms.

    I left everything at twips, and just created a 70,000 twip wide form, and it worked fine.

    I also left the ScaleMode at twips, and reported it. It reported 69885, which is larger than an unsigned 4-byte integer.

    I'm thinking there's a different problem.

    mdybus, if you're certain it's only on this system with the 2560 x 1440 monitor, then maybe it's just some variable you've (or whomever wrote the source) declared, and you're trying to place the form's width (or scalewidth) into it.

    For instance, I could easily crash my test as follows:

    Code:
    
    Option Explicit
    
    Private Sub Form_Load()
    
        Me.Width = 70000            ' Works fine.
        Me.ScaleMode = vbTwips      ' Just to force it.  Works fine.
    
        MsgBox Me.Width             ' Reports just fine.
        MsgBox Me.ScaleWidth        ' Reports just fine.
    
    
        Dim i As Integer
        i = Me.Width                ' Error 6, overflow !!!!!  (This is a problem in MY programming, not VB6.)
    
    End Sub
    
    

    Something like that is what I'd start looking for.

    Actually, if you just declare all your Integers to Longs, it may fix your problem. It's not an absolute certainty, but there's very seldom any harm in using Longs for integers anytime an integer is needed.

    Good Luck,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  6. #6
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,250

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    I don't think the problem was with the form itself, but with something on the form, in particular maybe a Picturebox being used to draw in. I thought I had an issue with drawing to a picturebox, if the size exceeded 32K, but it may have been something like a Picturebox in a Picturebox where the size of the inner picturebox exceeded 32K pixels in size. I can't remember now, and I know someone else created a picturebox inside a picturebox to create a vertical scrolling image, and it exceeded 32K pixels vertically without issue, so I may be in "left field".

    Using an Integer, rather than the VB6 standard of Singles for drawing coordinates could certainly be an issue, as you noted.

  7. #7
    Lively Member
    Join Date
    Feb 2004
    Posts
    104

    Re: UHD resolution gives run-time 6 overflow error

    Was there a 'resolution' confirmed for this problem? i have an application that runs on a customer's machine, found to trigger same "error 6 - overflow" error when using UHD (4K) monitor, 3840 x 2160 resolution. when he switches to 1920 x 1080 resolution the error does not occur.

    I don't have access to his setup, so difficult to debug. was the integer declarations found to correct the 'overflow' problem? Or was the problem found to be something else?
    /Jimboat

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,750

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    As you can see there was no follow up. Perhaps they found the loose screw behind the keyboard and took care of it?

  9. #9
    Lively Member
    Join Date
    Feb 2004
    Posts
    104

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Quote Originally Posted by dilettante View Post
    As you can see there was no follow up. Perhaps they found the loose screw behind the keyboard and took care of it?
    haha. nuts.
    /Jimboat

  10. #10
    Lively Member
    Join Date
    Feb 2004
    Posts
    104

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Quote Originally Posted by dilettante View Post
    As you can see there was no follow up. Perhaps they found the loose screw behind the keyboard and took care of it?
    different question - since i don't have a UHD monitor (3840 x 2160) setup available, it's tough to debug my program. i can't find any direct references to width or height in the forms that are triggering the 'overflow error'. Is there a way to 'fool' my program that resolution of monitor is actually 3840 x 2160? (then i can trap the error where it really occurs).
    /Jimboat

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,750

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Well, for most purposes one can simulate this with a multimonitor setup if you turn on the option to extend the desktop across all monitors. Both height and width might be a challenge but one a time seems doable.

  12. #12
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,765

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    It must be some variables that you declared as Integer. Use Long type instead.

    I don't think that you can fake the resolution to something larger than the monitor that you actually have (at least normally, but some driver may allow you), but you could send a code snippet to others (here) to test on 4K screens.
    Or make a test exe and execute it on another machine with a 4K monitor.

  13. #13
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,250

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    I just bought a few 4k smart TVs to use at the three common areas that I work, since you can usually pick up a 43" to 50" for $200 or less. Much cheaper compared to a dedicated 4K monitor.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  14. #14
    Lively Member
    Join Date
    Feb 2004
    Posts
    104

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Quote Originally Posted by Eduardo- View Post
    It must be some variables that you declared as Integer. Use Long type instead.
    yes! This sounds like the probable cause. my problem is i'm working with alot of code, and need to first locate where the error is occurring, and i don't have a UHD system (computer/monitor) to test with. so error identification is difficult.

    One of my users identified that 2048 x 1546 resolution is ok, 2560 x 1920 = error, 2560 x 1600 with DPI=150% is ok. So really sounds like i've got a 32k twip reference somewhere that is causing overflow ie: 32000twip / 15 = 2133 pixel limit?

    Quote Originally Posted by Eduardo- View Post
    I don't think that you can fake the resolution to something larger than the monitor that you actually have (at least normally, but some driver may allow you), but you could send a code snippet to others (here) to test on 4K or UHD setup.
    i'd love to post a snippet so that i could get more specific help from you guys, but i first need to locate the part of the program that is causing the error.

    Quote Originally Posted by Eduardo- View Post
    Or make a test exe and execute it on another machine with a 4K monitor.
    yes, i don't have that ability to access a 4K setup right now, but looking around.

    Quote Originally Posted by passel View Post
    I just bought a few 4k smart TVs to use at the three common areas that I work, since you can usually pick up a 43" to 50" for $200 or less. Much cheaper compared to a dedicated 4K monitor.
    Seems like a good alternative. Do the '4k smart tv's work just as well as a 4k computer monitor? what's the actual difference?
    /Jimboat

  15. #15
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    2,291

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Quote Originally Posted by Jimboat View Post
    Seems like a good alternative. Do the '4k smart tv's work just as well as a 4k computer monitor? what's the actual difference?
    Besides having to sit at least 4 feet away?
    One System to rule them all, One IDE to find them,
    One Code to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  16. #16
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,250

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    I don't know if there is that much difference between the monitor and TV for basic usage. The first 4K TV I bought a few years ago was a 50" and cost me about $280 at the time. I bought it on a whim as it was less than 50% of the cost of the TV new (it was an open box return). Since that worked fine for me as a "big" terminal, I looked online to see what was available so I could buy another one for work, and there was a special one time offer for a 43" inch model for $200 (remember this was over 2 years ago), so I bought one and took it to work and used it as the center "monitor" and had my original two 24" (1920x1200) monitors on each side of it.

    As for "having to sit at least 4 feet away", since my 24" monitors were 1920 pixels horizontal then technically, to have the text be the same size on the larger monitor it would need to be about a 48" TV being it is twice the pixel count horizontally. Since it was 43 inches, the pixel density was actually a bit tighter, so the size of a window shrank about 10% when dragging from a side monitor onto the center monitor.
    So, the TV gave me the desktop space of four 24" 1920x1080 monitors, but actually in a slightly smaller pixel size so you wouldn't want to sit further away from it than you would a "regular" monitor.

    I thought about swapping the 50" for the 43" at work, as that would be closer to the same size window when you dragged from one monitor to the other, but the 43" is more convenient. It is just small enough and light enough that I can easily carry it under one arm if I need to move it from one space to another within work, or carry it out to the car.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  17. #17
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,571

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Actually, when I first got my latest computer (Asus GL702VS-RS71), I plugged it into my 70" 4K TV and it worked just fine (including the VB6 IDE, and some test programs). However, I'd never use that configuration for trying to get any real work done (but I do like the idea of a single very large desktop).

    Some things were very fuzzy on my TV, that I'd never noticed when actually watching TV. Apparently there really is a quality/specifications distinction between TVs and monitors. One is apparently better for movement, and the other is much better for static images (which is what we primarily have on our monitors). I researched the distinctions, but it's now faded in my memory. I've currently got two monitors on this system. One is 3440x1440 and the other is 1920x1080, and everything works fine, including VB6 programs I develop, some with very large forms.

    ----

    In VB6, I quit using the Screen object a while back, as it does have several problems. I just have a BAS module now with all kinds of monitor procedures in it. I've posted the vast majority of these procedures in the CodeBank and in various threads here.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  18. #18
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,765

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    I have a 4K TV attached to the computer as a second monitor, and I do not see any problem to use it as a monitor other than, may be, it is too big, as other already mentioned.

    If there are differences between a monitor and a TV I would say that the monitor does not have a buit-in TV-tuner.
    I think the monitors have smaller pitch pixels, that means more resolution at the same surface. That would mean that monitors are smaller in size for the same resolution (4K). That's why you need to watch the TV from farther away, because the pixels are bigger, because the whole screen is bigger.
    But if you are using the native resolution there is not intrinsic fussiness, or should not be, only that the pixels are bigger, so perhaps if you want to use a 4K TV as a monitor it sould be from 27' to 40' and not 100'

    PS: do not take this as the last word, the debate is open.
    Inter-pixel space is the same? (I mean the opaque space between pixels)

    Edit: I've read some articles and it seems that a difference is in the "Response Time and Input Lag", monitors are faster. That is important for gaming.

  19. #19
    Lively Member
    Join Date
    Feb 2004
    Posts
    104

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Thanks all for your feedback. I am now looking around for a UHD monitor or tv that could do 3840 x 2160. Unfortunately, will also need a computer w/graphics card sufficient to support 4K monitor. The total additional expense is starting to get significant, since all is just to debug my VB6 program. This is why i was trying to discover a way to 'fool' my program that resolution of monitor is actually 3840 x 2160, then i can trap the error where it occurs.
    Last edited by Jimboat; Nov 18th, 2020 at 01:15 PM.
    /Jimboat

  20. #20
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,751

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Monitor:
    https://www.walmart.com/ip/TCL-43-Cl...S421/220975865
    https://www.target.com/p/tcl-43-34-c...5/-/A-52177069
    $220

    Video card: (should work fins as long as you are not expecting top gaming performance)
    https://www.newegg.com/asus-geforce-...82E16814126170
    $140
    Last edited by jdc2000; Nov 18th, 2020 at 04:51 PM.

  21. #21
    PowerPoster
    Join Date
    Feb 2017
    Posts
    2,765

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Humm, do not spend too much on a video card, instead perhaps you would prefer to change the whole computer. New processors support 4K with the buit-in video system.
    Last edited by Eduardo-; Nov 18th, 2020 at 03:46 PM. Reason: typo

  22. #22
    Lively Member
    Join Date
    Feb 2004
    Posts
    104

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Quote Originally Posted by Eduardo- View Post
    Humm, do not spend too much on a video card, instead perhaps you would prefer to change the whole computer. New processors support 4K with buit-in video system.
    Right, thx. i will try to find cheap computer that is able to support cheap 3840 x 2160 monitor. Still trying to see if there is a software work-around to make my program see UHD monitor instead of real resolution.
    /Jimboat

  23. #23
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    6,571

    Re: DisplayResolution 2560 x 1440 gives run-time 6 overflow error program made with

    Ok, I've tried to re-trace my steps of figuring out why all TVs can't work well as monitors. And the keywords seem to be "Chroma Subsampling". I don't fully understand it all, but, again, it has to do with getting away with things when viewing motion that you can't get away with when viewing still (or seldom changing) images (such as what's typically on our monitors).

    Apparently, from a bit of Googling, not all TVs support the best level of this Chroma Subsampling (or, in some cases, not all the HDMI ports do). Whereas, with monitors, you're pretty much guaranteed to get the highest Chroma Subsampling. Maybe, when I was playing around, I didn't use the correct HDMI port, but it doesn't really matter to me, as I'm not going to use my den TV as a monitor.
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width