Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have stored the lines in array
and want to count the output.
But am getting error as count is not member of String
VB
Dim lines() As String
lines = File.ReadAllLines(Filepath)
Dim count As Integer = lines.Count
--- here am getting error at
lines.count


where is the problem please assist
Posted

ReadAllLines returns an array of strings. If you need the number of lines in a given file, use Length property.
 
Share this answer
 
Comments
Karwa_Vivek 14-Aug-12 7:46am    
The problem is That in One project it is working fine with count property.but in another its giving the error. Length property solves my problem for now. but why this that in different projects is not behaving the same. anyways will find the reason.. Thanks for your quick reply.
dan!sh 14-Aug-12 7:50am    
Count is an extension method added in .Net 3.5 framework. It is NOT a property while length is a property.
Shouldn't that be:

Dim lines As String()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900