Guys,
Each item which I add to my listbox is a group of concatenated strings, each string holds a different piece of information about a document. Although this information is being added to the listbox as a single item, I am trying to create some alignment between each of the individual strings which make up the item to be added. The reason for this is that the length of the strings vary widely from one document to the next, which gives it a messy layout in the listbox.
I have already produced this crude solution which evaluates the length of each string to be concatenated and then applies a certain number of tabs (which works for every occurence so far) but is there a better way, or something I have completeley overlooked?
Thanks guysarrDoc(i) = cboDocType.Value arrDiscip(i) = cboDiscip.Value arrNo(i) = cboNo.Value arrSub(i) = txtSub.Value arrDocNum(i) = txtProjNo.Value & "-" & cboDocType.Value & "-" & cboDiscip.Value & cboNo.Value If Len(arrDocNum(i)) = 16 Then arrDocNum(i) = arrDocNum(i) & vbTab & vbTab & vbTab & strDocTitle Else arrDocNum(i) = arrDocNum(i) & vbTab & vbTab & strDocTitle End If If Len(strDocTitle) <= 7 Then arrDocNum(i) = arrDocNum(i) & vbTab & vbTab & vbTab & vbTab & txtSub.Value ElseIf Len(strDocTitle) > 7 And Len(strDocTitle) <= 14 Then arrDocNum(i) = arrDocNum(i) & vbTab & vbTab & vbTab & txtSub.Value ElseIf Len(strDocTitle) > 14 And Len(strDocTitle) <= 23 Then arrDocNum(i) = arrDocNum(i) & vbTab & vbTab & vbTab & txtSub.Value ElseIf Len(strDocTitle) > 23 And Len(strDocTitle) <= 30 Then arrDocNum(i) = arrDocNum(i) & vbTab & vbTab & txtSub.Value ElseIf Len(strDocTitle) > 31 And Len(strDocTitle) < 33 Then arrDocNum(i) = arrDocNum(i) & vbTab & vbTab & txtSub.Value ElseIf Len(strDocTitle) >= 33 Then arrDocNum(i) = arrDocNum(i) & vbTab & txtSub.Value End If ListBox1.AddItem arrDocNum(i)