Trimming a label - Printable Version +- BP Forums (https://bpforums.info) +-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55) +--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56) +---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8) +----- Forum: Code Snippets (https://bpforums.info/forumdisplay.php?fid=18) +----- Thread: Trimming a label (/showthread.php?tid=549) |
Trimming a label - brandonio21 - 06-28-2012 I was contacted the other day asking to hand over a code snippet that trimmed a label if it was too long, making it display "...". So, I crafted a method that would do so! Code: 'This method is intended to trim a label that is too long and replace it with Usage: Code: Dim Label As New Label Pastebin version: <!-- m --><a class="postlink" href="http://pastebin.com/PPgYrNqm">http://pastebin.com/PPgYrNqm</a><!-- m --> Re: Trimming a label - Vinwarez - 07-10-2012 I just stumbled upon this post and when I saw the code, it reminded me on something. Quote:Public Sub TrimLabel(ByVal label As Label, ByVal MaxCharCount As Integer)Does "ByVal" means decalring a parameter for method? Like in Java? Would it be something like this in Java? Code: public void TrimLabel(label Label, int MaxCharCount){ Re: Trimming a label - brandonio21 - 07-10-2012 Vinwarez Wrote:Does "ByVal" means decalring a parameter for method? Like in Java? This is exactly right! Of course, I don't think that ByVal is completely necessary in VB.NET. For example, I think the code snippet Code: Public Sub TrimLabel(label As Label,MaxCharCount As Integer) But yes, you are right! |