Search This Blog

Monday, September 29, 2014

GetDrives C# Example

C# > Files > DriverInfoGetDrives 

Retrieves the drive names of all logical drives

Example:
DriveInfo[] allDrives = DriveInfo.GetDrives();

foreach (DriveInfo d in allDrives)
{
   tvLeft.Nodes.Add(d.Name);  
}





Thursday, September 25, 2014

RichTextBox control insert color text

C# > RichTextBox Control > SelectionColor 


Gets or sets the text color of the current text selection or insertion point.

Example

private void AppendText(RichTextBox rtb, string text, Color color)
{
       rtb.SelectionStart = rtb.TextLength;
       rtb.SelectionLength = 0;

       rtb.SelectionColor = color;
       rtb.AppendText(text);
       rtb.SelectionColor = rtb.ForeColor;
}

AppendText(richTextBox1, "Blue", Color.Blue);

AppendText(richTextBox1, "Red", Color.Red);   






Wednesday, September 24, 2014

Telerik RadGridView clear all rows

Telerik > RadGridView > Rows > Clear

Clear  is a efficient solution to remove all rows since the grid's events will be suspended.

Example
this.radGridView1.Rows.Clear();






Bach file Current Directory Example

Bach file > Current directory 

set CURRENT_DIR=%CD%
cd ..\..\install\kits
install.bat
cd %CURRENT_DIR%





Tuesday, September 23, 2014

Configure Jenkins to use Mercurial

Jenkins > Mercurial 

Mercurial Plugin: Install the Jenkins Mercurial Plugin first (read more https://wiki.jenkins-ci.org/display/JENKINS/Mercurial+Plugin)



Source Code Management: Configure for Mercurial













Reduce unnecessary builds by specifying a comma or space delimited list of "modules" within the repository. A module is a directory name within the repository that this project lives.




To do that press advanced button:

This will detect changes only in sdks subdirectory in src directory:


Wednesday, September 17, 2014

Environment UserName property C# example

C#  > System > Environment ClassUserName

UserName is used to identify the user on the current thread, the user name of the person who is logged on to Windows.

Example



  string user = Environment.UserName;





SetEnvironmentVariable C# Example

C#  > System > Environment ClassSetEnvironmentVariable

SetEnvironmentVariable creates, modifies, or deletes an environment variable. 


Example



Environment.SetEnvironmentVariable("VisualStudioVersion", "10.0");