Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data Type Mismatch and I cannot find it.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00671836
Message ID:
00671869
Vues:
18
>Hello everyone!
>
>I get a data type mismatch whenever my form init runs. It displays my form anyway and I bypass the error with Ignore. After I bypass the error I am able to run my form and navigate Top, Prev, Next, Bottom without any more errors. The error obly happens when in Form Init. The form is modal. It is called by a .PRG with a DO FORM myForm command. The form is just a bunch of textboxes with some character fields, some numeric fields, and a date field. All data is displayed in all fields correctly even when navigating between records. When I ran debugger to help find the error, I suspend the form running and go to Trace window and get the error, Source is out of date.
>I am out of ideas. Got any ideas? Thanks very much. There must be something I am overlooking.
>
>Here is the Init coding-
>
>_SCREEN.CAPTION = "AGENCY MAINTENANCE"
>USE agency IN 0 SHARED
>SELECT agency
>GO BOTTOM
>SCATTER MEMVAR MEMO
>* Build form caption
>mast_cap = ALLT(m.agcy_name)
>isediting = .F.
>THISFORM.Caption = "BROWSING   " + mast_cap
>*THISFORM.Refresh
>*THISFORM.Setbackcolor
>THIS.LockScreen = .T.
>* Set data entry boxes backgrnd color
>* Yellow is no data, White is data
>FOR ii = 1 TO THIS.ControlCount
>	IF THIS.Controls(ii).BaseClass = "Textbox" OR ;
>		THIS.Controls(ii).BaseClass = "Editbox" OR ;
>		THIS.Controls(ii).BaseClass = "Combobox" OR ;
>		THIS.Controls(ii).BaseClass = "Checkbox"
>    	   THIS.Controls(ii).BackColor = ;
>	    	IIF(EMPTY(THIS.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
>	       THIS.Controls(ii).DisabledBackColor = ;
>   			IIF(EMPTY(THIS.Controls(ii).Value),RGB(255,255,128),RGB(255,255,255))
>	ENDIF
>NEXT
>THIS.Lockscreen = .F.
>THISFORM.Refresh
>
Hi Steve,

Remove all the code, where you set backcolor. Make your own classes Combobox, textbox, checkbox, EditBox. Put this code in its refresh method:

this.backcolor = iif(empty(this.value),yellow, white) (make numbers instead).

This should work for every record.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform