Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27212

VS 2012 Help Changing the Text displayed in a Text Box at runtime

$
0
0
So am trying to add a feature to an existing app I have written. The app builds a string based up on the input into four different text boxes which would then limit the amount of text in the last textbox. During run time data will be inputted into all four textboxes at anytime before the final string is put together . I need the three control boxes them being customer ,issue & ticket to control the amount of text available in the resolution box.

Some times I will have be editing one of the control boxes and adding more data. If the resolution box or the controlled box is at its character limit I want the existing text in it to be truncated or lets say I put 10 more characters into the customer box I want to lop off the last 10 characters in the resolution box. I can get it to handle that on the string side of it but the text box on the form will still display the original text or rather not show the truncation of that box. What I am wanting is real time feedback or I want to see those characters being lopped of as I type. I know or guess assume I want this triggered on a form event such as text changed but after that I am lost.

Code:

  Private Sub customer_TextChanged(sender As Object, e As EventArgs) Handles customer.TextChanged
        'Get the length of the characters entered and put into the variable of boxlength
        boxlengthcustomer = customer.TextLength
        resolution.MaxLength = (500 - boxlengthcustomer - boxlengthissue - boxlengthticket)
    End Sub

    Private Sub issue_TextChanged(sender As Object, e As EventArgs) Handles issue.TextChanged
        'Get the length of the characters entered and put into the variable of boxlength
        boxlengthissue = issue.TextLength
        resolution.MaxLength = (500 - boxlengthcustomer - boxlengthissue - boxlengthticket)
    End Sub

    Private Sub ticket_TextChanged(sender As Object, e As EventArgs) Handles ticket.TextChanged
        'Get the length of the characters entered and put into the variable of boxlength
        boxlengthticket = ticket.TextLength
        resolution.MaxLength = (500 - boxlengthcustomer - boxlengthissue - boxlengthticket)
    End Sub

   
    Private Sub Form1_TextChanged(sender As Object, e As EventArgs) Handles Me.TextChanged
        resolution.MaxLength = (500 - boxlengthcustomer - boxlengthissue - boxlengthticket)
    End Sub


Viewing all articles
Browse latest Browse all 27212


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>