Hi,
I am developing an windows application in vb.net.
in this project i want to set the Richtextbox height according to the content in that richtextbox. For this i want to call the Richtextbox textchanged event on button click
Here is my code but i got error
on button click
RichAll_KeyPress(sender, New KeyPressEventArgs(e))
and
Private Sub RichAll_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs)
Dim tempFont As Font = DirectCast(sender, RichTextBox).Font
Dim textLength As Integer = DirectCast(sender, RichTextBox).Text.Length
Dim textLines As Integer = DirectCast(sender, RichTextBox).GetLineFromCharIndex (textLength) + 1
Dim Margin As Integer = DirectCast(sender, RichTextBox).Bounds.Height - DirectCast(sender, RichTextBox).ClientSize.Height
DirectCast(sender, RichTextBox).Height = (TextRenderer.MeasureText(" ", tempFont).Height * textLines) + Margin + 2
End Sub
How i can solve the issue
can i call textchanged event
Thanks in advance...