Note that there are some explanatory texts on larger screens.

plurals
  1. POtiming issues in vb.net
    primarykey
    data
    text
    <p>I think i have a timing issue. It perplexes me why. </p> <p>On the trigger of an event I call a function to update a value:</p> <pre><code>Private Sub t0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t0.Click Input.ppProperty = "blank" UpdateRecord("Hey", Input.ppProperty) MsgBox(Input.ppProperty) End Sub </code></pre> <p>UpdateRecord() should update the property Input.ppProperty to the value "Hey". It does update it, but not until UpdateRecord() has finished. The code:</p> <pre><code>Sub UpdateRecord(ByVal updateValue As String, ByRef recordToUpdate As String) If recordToUpdate &lt;&gt; Nothing Then MsgBox(updateValue &amp; " " &amp; recordToUpdate &amp; " " &amp; Input.ppProperty) End If recordToUpdate = updateValue If recordToUpdate &lt;&gt; Nothing Then MsgBox(updateValue &amp; " " &amp; recordToUpdate &amp; " " &amp; Input.ppProperty) End If End Sub </code></pre> <p>Output:</p> <blockquote> <p>Hey Blank Blank 'initial values <br/> Hey Hey Blank 'values at the end of the function <br/> Hey 'value of property when function is finished <br/></p> </blockquote> <p>What it seems like it should be is: </p> <p>Desired Output:</p> <blockquote> <p>Hey Blank Blank 'initial values <br/> Hey Hey Hey 'values at the end of the function <br/> Hey 'value of property when function is finished <br/></p> </blockquote> <p>Notice the difference, the property does not update until the function is completely finished. Why?</p> <p><strong>EDIT:</strong> Also, how would I go about fixing this so it updates within the function?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload