<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Help Answer &#187; Programming</title>
	<atom:link href="http://helpanswer.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://helpanswer.com</link>
	<description>Help in getting the most affiliate sales</description>
	<lastBuildDate>Thu, 03 Jun 2010 15:46:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>VB6: How To Pause A Program</title>
		<link>http://helpanswer.com/vb6-how-to-pause-a-program/</link>
		<comments>http://helpanswer.com/vb6-how-to-pause-a-program/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 22:41:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://helpanswer.com/?p=112</guid>
		<description><![CDATA[Just recently, I needed to implement a pause or delay loop in a Visual Basic 6 program. Being lazy, my first instinct was just to do a for-next loop with a DoEvents in the middle. But this gave different results on different machines, which wasn&#8217;t what I was looking for. The I tried using the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhelpanswer.com%2Fvb6-how-to-pause-a-program%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhelpanswer.com%2Fvb6-how-to-pause-a-program%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Just recently, I needed to implement a pause or delay loop in a Visual Basic 6 program.</p>
<p>Being lazy, my first instinct was just to do a for-next loop with a DoEvents in the middle. But this gave different results on different machines, which wasn&#8217;t what I was looking for.</p>
<p>The I tried using the Sleep API call.</p>
<p><span id="more-112"></span>But more often than not, it seemed to put the whole machine to sleep, not just my program. Plus in development, it ignored me pressing Break most of the time.</p>
<p>Next up, a friend suggested using the timer control. Which would probably work but has a maximum delay time and I had more hassle than I&#8217;d like trying to get it to work as intended.</p>
<p>A web search came up with lots of people asking the same question but not many actual answers. Most of these seemed to revolve around using the Sleep API call.</p>
<p>Finally, I did what I should have done and wrote my own short routine.</p>
<p>Just send a figure in seconds to the routine and it will run in a loop until that time is up. Simple, effective and it works without hogging the whole machine.</p>
<pre>Public Sub DelayLoop(myDelay As Double)
Dim StartTime, EndTime
StartTime = Now
EndTime = DateAdd("s", myDelay, StartTime)
Do While CDbl(Now) &lt; CDbl(EndTime)
	DoEvents
Loop
End Sub</pre>
]]></content:encoded>
			<wfw:commentRss>http://helpanswer.com/vb6-how-to-pause-a-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Basic 6 Round Error</title>
		<link>http://helpanswer.com/visual-basic-6-round-error/</link>
		<comments>http://helpanswer.com/visual-basic-6-round-error/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 17:58:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://helpanswer.com/?p=6</guid>
		<description><![CDATA[I just hit an interesting error in VB6 today. I was trying to calculate a distance between two points. No problem there except I didn&#8217;t want to put something on a page that said &#8220;48.723569&#8243; miles. That would look dumb. No problem, I thought, I&#8217;ll format the output using VB&#8217;s format command, giving the number [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fhelpanswer.com%2Fvisual-basic-6-round-error%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fhelpanswer.com%2Fvisual-basic-6-round-error%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I just hit an interesting error in VB6 today.</p>
<p>I was trying to calculate a distance between two points. No problem there except I didn&#8217;t want to put something on a page that said &#8220;48.723569&#8243; miles. That would look dumb.</p>
<p>No problem, I thought, I&#8217;ll format the output using VB&#8217;s format command, giving the number string as &#8220;#####0.0&#8243;.</p>
<p>But for certain numbers, format kept giving me the answer 0.0</p>
<p>No problem, I&#8217;ll use Round instead.</p>
<p>Same error. Some calculations worked, others got rounded to zero regardless&#8230;<span id="more-6"></span></p>
<p>Debugging showed that the number was too long to display properly (pi is involved in the calculation, so in theory the number goes on forever).</p>
<p>Instead VB&#8217;s debug window displayed the start of the number but ended it in &#8220;E-02&#8243;</p>
<p>Which is was what confusing Format and Round.</p>
<p>My working (but probably not elegant) solution was to cstr the number, remove the E-02 part and then carry on:</p>
<p>SortedDistance = CStr(myDistance)<br />
SortedDistance = Replace(SortedDistance, &#8220;E-02&#8243;, &#8220;&#8221;)</p>
<p>Two simple lines that got rid of the headache.</p>
]]></content:encoded>
			<wfw:commentRss>http://helpanswer.com/visual-basic-6-round-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
