TextBox Values not updating on click command

General Tech Learning Aids/Tools 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

Im experimenting with upgrading from VBA to VB.NET, so I am learning some pretty basic stuff by figuring out the syntax differences between things I have done and). So far so good, but I cant seem to get a textbox to update the display value in the form. Anyone want to explain why I am dumb? I spent some time surfing the various interweb stuff, but have yet to find anything(unless I am dumb and just didnt understand it when i saw it).

Here's what I have so far:

    Dim this As String = Trim$(Mid$(TextBox1.Text, InStr(TextBox1.Text, "&") + 1))
    Dim oldtxt As String = TextBox1.Text
    If InStr(TextBox1.Text, "&") > 0 Then
        TextBox1.Text = TextBox1.Text.Replace(TextBox1.Text, "End Date Copied" & this)
        Clipboard.SetText(this)
        Threading.Thread.Sleep(2000)
        TextBox1.Text = TextBox1.Text.Replace(TextBox1.Text, oldtxt)
    End If
profilepic.png
manpreet 2 years ago

After digging through the UI of visual studio I was able to find a more "band-aid" type of resolution. Even though I havent messed with SubString function yet, that is my next learning step, I found this option to be sufficient in the immediate resolution. If I find a better way of implementing this I will post back for others to see (if they care).

 Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Block1.Enter
 Dim this As String = Trim$(Mid$(TextBox1.Text, InStr(TextBox1.Text, "&") + 1))
 Dim oldtxt As String = TextBox1.Text
 If InStr(TextBox1.Text, "&") > 0 Then 
      TextBox1.Text = TextBox1.Text.Replace(TextBox1.Text, "End Date Copied" & this)
      Block1.Refresh()
      Clipboard.SetText(this)
      Threading.Thread.Sleep(200)
      TextBox1.Text = TextBox1.Text.Replace(TextBox1.Text, oldtxt)
      Block1.Refresh()
 End If
 End Sub

And just an FYI for @TEK, Enter and Click events for this work identically, so hopefully next time you try and help someone you wont get hung up on unnecessary details :)


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community