I want to execute my “textbox changed” code (1) when I change the code in my text box, and (2) in other places in my code.
I would like to do this without creating a separate subroutine, as I have done in the following example:
Chat AI suggested two things that generated error messages. They were:Code:Sub GetIterMax() ‘ My code for getting the maximum number of iterations End sub Private Sub TbxIterMax_TextChanged(sender As System.Object, e As EventArgs) Handles tbxIterMax.TextChanged GetIterMax() End Sub
Let’s see if humans can do better.Code:tbxIterMax.OnTextChanged(New EventArgs()) Error BC30390” TextBoxBase.Protected Overrides Sub OnTextChanged(e As EventArgs)' is not accessible in this context because it is 'Protected'. RaiseEvent tbxIterMax.TextChanged(tbxIterMax, New EventArgs()) Error BC30676: tbxIterMax is not an event of form1
I’m using Visual Basic in Visual Studio 2022.
Windows 11




Reply With Quote
