Google Brother Up

2008/12/19

Split a string separated by ";" and place in an array

How to split a string like this ";1;2;3;4;5;6" and put in on an array?

string mstrStream = mstrSelectedRowsStream.Remove(0,1); // to remove the semicolon on the extreme left

char chSep = ';';
string[] arrStr = mstrStream.Split(chSep);


How to get each number back from that array?

for (int i = 0; i <>
{
     string s = arrStr[i].ToString();
}

145 unique visitors

2008/12/12

Fundas on Server Paths

1. Server.MapPath(strPath)

2. (asp:Image ImageUrl=“~/images/pictures.gif runat=“server“/)

3. TextWriter tw = new StreamWriter(~"\\servername\test.txt");
tw.WriteLine("test1");
tw.Close();


4. @"C:\test\source\folder3.cs")

143 unique visitors

How to get a Path & Xml file values into a Dataset

string dtxmlFilePath = "datatypes.xml";

FileStream dtFileStream = new FileStream(Server.MapPath(dtxmlFilePath), FileMode.Open, FileAccess.Read);

StreamReader dtXmlStream = new StreamReader(dtFileStream);

ds.Tables[0].ReadXml(dtXmlStream);

dtFileStream.Close();

143 unique visitors

Convert a string to Proper Case or Sentence Case

using System.Globalization;

CultureInfo cc = new CultureInfo("");
TextInfo ti = cc.TextInfo;
ti.ToTitleCase(mlstSelectedColumn
.ColumnDataTypeCSharp)

143 unique visitors

Drop Down List

1. http://www.janetsystems.co.uk/Articles/NetArticles/tabid/74/itemid/161/modid/449/Default.aspx