Question:
Working in vb but not compiled?
2007-02-02 02:49:53 UTC
We have a Visual Basic 6 program. On one form we have a command button. When clicking on the command button, the is a procedure that opens a com port, and a timer control is activated, the timer control contains code to retrieve the weight from a scale and present it on a textbox that we have on the form.

When we run the program inside Visual Basic 6 environment, the weight is retrieved successfully from the scale and is presented in the textbox but when we compile the program and click the command button, the weight is not retrieved from the scale and is not presented in the textbox. We believe that all the code is perfectly fine because if it works inside VB, why it should not work when compiled? We have the feeling that it may be related to the timer control in the form that is not been able to handle the resources of the program properly?

We need help urgently! Thanks in advance. What are your suggestions?
Three answers:
2007-02-02 04:30:18 UTC
Add code to your program to write to a text file to help you debug.



If you're not using any external references, then it shouldn't be a problem.



Are you sure that the port is closed properly before opening your compiled program? If the port wasn't open, I can see it not working, and then working again in the debugging environment.
?
2016-10-16 14:57:05 UTC
you have not wasted your week. you have explored and found out what would not artwork (that's generally greater significant that what does). i can't see your documents, despite if it incredibly is not likely that each and each of those one thousand values ought to be dealt with in yet in any different case from each and all of the others. examine the values and spot if there is a thank you to shrink the form of tests, the two with a case assertion (foremost) or if-else's. working example, each and all of the 9100's may be dealt with one way, whilst the 9200's a different way. My VB is rusty, yet i think of there is a thank you to define stages to boot to individual values. One expert tip: don't be tempted to overlap code between situations that don't incredibly tournament up. It in basic terms finally ends up in difficulty. desire that helps.
Pfo
2007-02-02 06:20:48 UTC
Another difference too is that your compiled code might be optimized, and the optimizer can break your code. See if you can turn optimizations off, or play around with them to see if you can get it working.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...