Linecount

torisch

Newcomer
Joined
Jan 23, 2003
Messages
11
Location
Tromsø - Norway
Is there a way I can get Visual Studio to tell me how many lines of code there is in a project/solution, or do I have to check each file my self, and sum the linecount for each file?
--
Tor Inge
 
Visual Basic:
'//Imports WindowsApplication1.Module1 << ignore
Imports System.IO
'///top of form's code window

    Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Private Const EM_GETLINECOUNT As Integer = CInt(&HBA)

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Integer
        Dim sr As StreamReader = New StreamReader(New FileStream("C:\Documents and Settings\den\My Documents\Visual Studio Projects\WindowsApplication1\Form1.vb", FileMode.Open), True)
        TextBox1.AppendText(sr.ReadToEnd.ToString())
        i = SendMessage(TextBox1.Handle.ToInt32, EM_GETLINECOUNT, 0, 0)
        MsgBox(i) '/// i will return the line count of form1
        sr.Close()
    End Sub
you would have to repeat the procedure for each form :)
i'm glad that worked :p
 
Tools -> Options -> Text Editor -> All Languages -> General -> Line Numbers (checkbox)

(Or am I missing the point :-\ )
 
Back
Top