this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Tuesday, April 28, 2009

Add new Line Character in Vb.net String.

While we want new line in C# we just use "\n" but if you use this in vb.net you will not get the desired result. Vb.net is bit a different then others you have some other choice to do this...

For new line character you can use one of following items..

VB Constants: vbNewLine, vbCrLf
Character Function:
Chr(13)
VB Control Chars:
ControlChars.NewLine, ControlChars.CrLf
Environment Variable:
Environment.NewLine

Monday, April 27, 2009

Read- Write Project Setting throw code ..in .net

Our connection string name and some of other settings mostly resides in our project setting files like app.config or web.config. 

In our code we want to grab this information from these setting files..there is bit a difference in VB.net and C# to access this infromation.

VB.NET
In vb.net we have My named namespace 

syntax for vb.net 
My.Settings.Item("Keyname") = "value to store" 
My.Settings.Save()

C#

In C# we have to use System.Configuration name space to access this information.

syntax for c#
System.Configuration.ConfigurationManager.AppSettings["KeyName"]  =  "value to store"

Here,In key name we can also use index of key.