.net - What is an easy way to make scrollbars in a VB.Net TextBox only show up when needed? -


i've been doing little bit of looking around, far, haven't seen i'm looking for. have textbox designed label in vb.net program, because labels aren't capable of same things textboxes are. want scrollbar on each axis shown when , when needed. font uses different widths different characters, , that's not i'm going able change this.

how can scrollbars put on there? i'm little green in terms of vb.net gui design, answers involve 30 lines of code 1 thing going little hard follow , apply. need isn't overly complicated, if that's possible. thanks!

update

i wrote function link have posted here. should you. ( please make sure test textbox textbox6 not textbox1)

private sub textbox6_textchanged(sender object, e eventargs) handles textbox6.textchanged     if checklength(textbox6.text) = true         textbox6.scrollbars = scrollbars.vertical     else         textbox6.scrollbars = scrollbars.none     end if end sub  private function checklength(byval longstr string)     dim trueorfalse boolean = false      dim f font = me.textbox6.font     dim rect rectangle = textbox6.clientrectangle     dim charfitted integer     dim linesfitted integer     using g graphics = textbox6.creategraphics()         dim sf new stringformat(stringformatflags.nowrap)         sf.linealignment = stringalignment.center         sf.alignment = stringalignment.near         sf.trimming = stringtrimming.ellipsischaracter         sf.formatflags = stringformatflags.directionvertical         g.measurestring(longstr, f, rect.size, sf, charfitted, linesfitted)     end using      if charfitted < longstr.length         trueorfalse = true     end if      return trueorfalse end function 

this checks length of entire check box ( multi-line or not ), checklength boolean function returns true if textbox's length has been exceeded.

reguards


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -