Is it necessary to add a @ in front of an SqlParameter name?

According to the documentation, the name must start with an @: The ParameterName is specified in the form @paramname. According to the source code (have a look at SqlCommand and SqlParameter.ParameterNameFixed in the reference source), an @ is added automatically, if needed. So yes, it works, but it’s an undocumented feature. Best practice recommends that … Read more

Multiline string variable

You (initially) marked this as c#, but show VB code. For c#: use the @ specifier: string myText = @”line 1 line 2 line 3″ Note that if you don’t want a blank line at the start of your string, make sure you put the @” on the same line as the first line of … Read more

Why is it not necessary to indicate ByVal/ByRef anymore?

It seems that this post covers your question: http://msmvps.com/blogs/carlosq/archive/2011/03/15/vs-2010-sp1-changing-quot-byval-quot-vb-net-code-editor-experience.aspx So no, there is no way to get the old behaviour. From now on ByVal is the default (what it was before) and it won’t get added automatically to the method parameters. In my opinion this is a good decision since it’s making VB.NET a bit … Read more

Enable copy, cut, past window in a rich text box

If you have more than one RichTextBox then you can use this extension method: public static void AddContextMenu(this RichTextBox rtb) { if (rtb.ContextMenuStrip == null) { ContextMenuStrip cms = new ContextMenuStrip() { ShowImageMargin = false }; ToolStripMenuItem tsmiUndo = new ToolStripMenuItem(“Undo”); tsmiUndo.Click += (sender, e) => rtb.Undo(); cms.Items.Add(tsmiUndo); ToolStripMenuItem tsmiRedo = new ToolStripMenuItem(“Redo”); tsmiRedo.Click += … Read more