General > Off Topic
Serious weirdness going on here.
Botsareus:
Try to see what DataEntery_Change() is doing... Debug.print it every time it changes...
This one even I never experianced although when vb ran out of memory it did wairder things...
Numsgil:
I seem to remember reading about some bugs in Visual Basic being related to not using Option Explicit. Something with how the program allocates variables at run time in debug mode vs. at compile time.
Sounds exactly like what you have going on here. How to fix it? I have no idea, as you say it's not as simple as including it.
PurpleYouko:
Here is an even weirder thing.
I decided to include a separate routine that would still enter the value from the text box if the user simply clicks elsewhere on the form instead of physically pressing enter.
The best way to do this?
Use the "lostfocus" event.
How to enter the value into the flexgrid?
I know! :idea: Let's just call the "change" event routine and send a value of 13 into it so that it thinks somebody has pressed the enter key. That way it will just follow existing code without havinbg to write more stuff.
here is the routine as I wrote it.
--- Code: ---Private Sub DataEntry_LostFocus()
DataEntry_KeyPress 13
End Sub
--- End code ---
Simple and elegent. And guess what. It works..... Perfectly. For some reason the bug in the "DataEntry_Keypress" routine doesn't rear it's head when the routine is entered this way. At least that proves that there isn't a typo in there.
I think I am just going to have to move the code into a third subroutine and call it from the keypress and the lostfocus events in the same way. Maybe they will both work then.
VB does some of the weirdest things without apparent reason. So many times I have had a program that runs perfectly for weeks then for some bizarre reason it just dies and returns some dumb-ass error. Nothing in the code has changed. It just plain doesn't work any more. :wacko:
Maybe I DO need to learn C++
PurpleYouko:
This is just nucking futs!!
It doesn't matter how many levels deep I go with calling subroutines from the keypress subroutine and it doesn't matter where or how I put breakpoints.
If there is a break point anywhere in the code (other than inside a conditional) then it works perfectly.
If there isn't then it doesn't. Period!
I had to get inventive in the end and add a global variable to hold the value of the textbox on a change event then tell it to kick out if the value after the change is null. Now it works but what a pain in the ass!
Navigation
[0] Message Index
[*] Previous page
Go to full version