Results 1 to 3 of 3

Thread: [RESOLVED] Auto-Spacing

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2009
    Posts
    31

    Resolved [RESOLVED] Auto-Spacing

    I don't know how to name it, so I named it autospacing

    When I type this code in VB:
    Code:
    Public Class Form1
    
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
    System.Console.WriteLine("example")
    
    End Sub
    
    End Class
    When I press enter, the code will automatticly go like this:

    Code:
    Public Class Form1
    
          Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
               System.Console.WriteLine("example")
    
          End Sub
    
    End Class
    but when I type a code in C# like this:

    Code:
    using System
    namespace examplecode
    {
    class exampleclass
    {
    static void Main()
    {
    Console.WriteLine("example");
    }
    }
    }
    it won't go right automaticly, is there a way to activate this?

    Thanks in advance! 8D

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Auto-Spacing

    Code formatting works differently in the VB and C# IDEs. If you have unformatted code in C#, try deleting and then retyping the last closing brace, i.e. '}'. Tada! That works for code blocks and for single lines the thing happens when you type the semi-colon at the end, i.e. ';'.

    Just note that C# requires that your syntax be valid in order to auto-format, which yours isn't. You'd need to add the semi-colon to the end of the 'using' statement first.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2009
    Posts
    31

    Re: Auto-Spacing

    Well, I typed this code out of my head, but I copied the code from a e-book I was learning, there using WAS with a ;, but in the middle of the code a page number showed up. I had to delete the number, cut-paste everything and C# did the trick! ^^
    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width