|
-
May 9th, 2013, 06:11 PM
#1
Thread Starter
New Member
Padding Questions
I am having an issue with padding and coding. Still early on in my visual basic understanding so please go easy on me.
I am trying to get text to line up in columns of a few array variables and am having a few issues. First this code below is throwing an error Whenever I go to run it stating: "Object reference not set to an instance of an object." A few other questions though, are why I can not pad my integer and if I wanted to display my integer depending on a checkbox, how would I need to work that code so that I don't put an If statement that would end up stating everything below followed by an else that contains all but the integer statement below? I hope these questions make sense, other than this part I think I'm in good shape.
txtList.Text &= intA(intForm) _
& strA(intForm).PadRight(15) _
& strB(intForm).PadRight(30) _
& strC(intForm).PadRight(45) _
& strD(intForm).PadRight(60) _
& strE(intForm).PadRight(76) _
& ControlChars.NewLine
-
May 9th, 2013, 06:58 PM
#2
Thread Starter
New Member
Re: Padding Questions
Just a quick update I got the error taken care of my padding sizes were way to big, but I am still unsure as to how to pad the integer?
-
May 9th, 2013, 07:23 PM
#3
Re: Padding Questions
PadRight is fine for just one value but, in this situation, it's not appropriate. Follow the CodeBank link in my signature and check out my thread on Fixed-Width Columns. It shouws you how to use String.Format to make the whole thing much cleaner and handle any data type with more functionality.
-
May 9th, 2013, 07:38 PM
#4
Thread Starter
New Member
Re: Padding Questions
Got it going, appreciate that
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|