Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Leaders
Posted

'//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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...