We have several legacy "Windows" applications built in Visual Basic 6 that until Windows Vista displayed normally. Now we have random textboxes that display with a black background, even before any records are brought into the form (and after as well). Some forms in one application have one or two texboxes displaying this behavior. On other forms it affects all textboxes on the form. When the first form initially displays there are no records on the form. On most of the forms in this application a user enters a sequence of numbers to fetch a record (or records) from the database. Other forms within the application bring up child records based upon the entry on the "parent" form. There is no code attached to the textboxes on the "parent" form, other than data being placed into them once a record is brought up from the database. Has anyone heard of this?

Recommended Answers

All 4 Replies

I had the same problem, and as vb5prgrmr said, you need to update your installable redistributable pack of all vb runtime files.

I had the same problem, and as vb5prgrmr said, you need to update your installable redistributable pack of all vb runtime files.

I have SP 6 on the development machine. Are there updates beyond SP 6?

The solution is (this came from a user in VBForums, si_the_geek):

Check what the ForeColor and BackColor properties of those textboxes contain - and compare it to the ones without the issue.

They are almost certainly different (even if they look like the same colour on the form), and I suspect that the valid ones use System colours (eg: Window Background/&H80000005&) while the ones with problems use Palette colours (eg: &H00000005&). It may be the opposite way around.

I would recommend using System colours for all of them, so that themes etc will be applied correctly. The standard for a textbox BackColor is "Window Background", and the standard ForeColor is "Window Text".

The offending controls "BackColor" were changed to &H80000005& and all show up as they should. Thank you for the replies.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.