| | |
Enter a loop when length is zero
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 324
Reputation:
Solved Threads: 7
0
#2 Oct 9th, 2009
VB.NET Syntax (Toggle Plain Text)
if strFile.Length <> 0 'Code end if
•
•
Join Date: Sep 2009
Posts: 321
Reputation:
Solved Threads: 45
0
#4 Oct 10th, 2009
Your array is not actually zero length, it has a length of one!
strFile is an array. The array can either be "nothing" or have at least one element to it; even if it is blank.
strFile = strSubCommittees.Split("|")
This will automatically assign at least one element to your array, even if it is blank and doesnt actually have a value in that element.
Try this in a console app to see the results:
strFile is an array. The array can either be "nothing" or have at least one element to it; even if it is blank.
strFile = strSubCommittees.Split("|")
This will automatically assign at least one element to your array, even if it is blank and doesnt actually have a value in that element.
Try this in a console app to see the results:
VB Syntax (Toggle Plain Text)
Sub Main() Dim strCommittees As String = "" Dim strFile() As String = Nothing If strFile Is Nothing Then Console.WriteLine("strFile() is nothing") Else Console.WriteLine("strFile.Length : {0}", strFile.Length) End If Console.WriteLine("'Read blank value into array") Console.WriteLine("strCommittees.Split(""|""c)") strFile = strCommittees.Split("|"c) Console.WriteLine("strFile.Length : {0}", strFile.Length) Console.ReadLine() End Sub
Last edited by TomW; Oct 10th, 2009 at 1:05 pm.
![]() |
Similar Threads
- strings, arrays, length program (C++)
- Creating an else to a for loop (PHP)
- help with adding items to a linked list. (Java)
- Dynamic Structure with For Loop Help Please (C++)
- Help with File Reading loop (C++)
- Need help writing a program (C++)
- Ideas needed for problem with trailing whitespaces (C++)
- I need help with a program (C++)
- I need to re-write this code using a 'while' loop. (Java)
- while loop in c++ help needed (C++)
Other Threads in the VB.NET Forum
- Previous Thread: calling sub from a different form
- Next Thread: Refresh DataGridView
Views: 315 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date design designer dissertation dissertations dropdownlist excel fade file-dialog filter ftp generatetags google gridview hardcopy images inline input insert installer intel internet listview mobile monitor net networking objects output panel passingparameters picturebox port position print printing problem read remove save searchbox searchvb.net select serial shutdown soap sorting studio survey table tcp temperature text textbox time timer timespan toolbox trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet visual visualbasic visualbasic.net visualstudio2008 web webbrowser winforms wpf year





