SEARCH ALL FLOPPY,CD AND HARD DISK DRIVES

Labels:

//search all floppy,cd and hard disk drives available in our PC
//its varies from system to system


for(char Ch='A';Ch<='Z';Ch++) { string Dir = Ch + @":\"; if (Directory.Exists(Dir)) {
disksListBox.Items.Add( Ch+ @":" ); //Add into ListBox
}
}

COPY AND PASTE THE DATA USING CLIPBOARD

Labels:

//copy the data using Clipboard

Clipboard.SetDataObject(textBox1.SelectedText,true);

//paste the data using Clipboard

IDataObject iData = Clipboard.GetDataObject();

//Determine whether the data is in a format you can use.

if(iData.GetDataPresent(DataFormats.Text))
{
textBox1.SelectedText =(String)iData.GetData(DataFormats.Text); //display it in a text box.
}

GET THE USER NAME IN C# FOR NT AUTHENTICATION

Labels:

//Declare the Header File

using System.Security.Principal;
string a;

a=System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

//Above Statement,opens us up to more than just the current user.

MessageBox.Show(a.ToString());