Wednesday, February 3, 2010
How to make elipse or circle in win application in C#.net
hi dear,
To draw a circle or elipse in win application u have to use VisualBasicPowerPacks controls. you can add them by add reference of VisualBasicPowerPacks,if you are not getting them there then install VisualBasicPowerPacks by VisualBasicPowerPackssetup.exe and then add reference of VisualBasicPowerPacks.
Enjoy!
@nil!
Tuesday, February 2, 2010
How to use java script in win application in C#.net
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Reflection;
using Microsoft.JScript;
CodeDomProvider p;
CompilerParameters cp;
CompilerResults cr;
Assembly asmbly;
Type Type;
object Obj;
string javascript = //suppose I have a API for label1.
@"class a
{
var label1='Hi dear';
}";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
p = (CodeDomProvider)Activator.CreateInstance("Microsoft.JScript", "Microsoft.JScript.").Unwrap();
}
private void button1_Click(object sender, EventArgs e)
{
this.para = new CompilerParameters();
this.cp.GenerateInMemory = true;
this.cr = provider.CompileAssemblyFromSource(this.cp, javascript);
this.asmbly = cr.CompiledAssembly;
this.Type = assembly.GetType("a");
this.Obj = Activator.CreateInstance(this.Type);
object retValue = this.Type.InvokeMember("label1", BindingFlags.GetField, null, this.Obj, null);
label1.Text = retValue.ToString();
}
How to send mail in C#.net
//in web.config
//in cs
using System.Net.Mail;
MailMessage Mail = new MailMessage("mailaddressfrom@smartit.com", "mailaddressto@smartit.com");
Mail.Subject = TextBox2.Text;
Mail.IsBodyHtml = true;
Mail.Body = FCKeditor1.Value;
Mail.Priority = MailPriority.High;
for (int i = 0; i < a.Count; i++)
{
Mail.Bcc.Add(a[i].ToString());
}
SmtpClient smtp = new SmtpClient();
smtp.Send(Mail);
How to Create Trigger in sql
CREATE TRIGGER trig1 ON trig_example FOR INSERT
as
IF (SELECT COUNT(*) FROM INSERTED
WHERE salary > 100000) > 0
BEGIN
print "TRIG1 Error: you attempted to insert a salary > $100,000"
ROLLBACK TRANSACTION
END
CREATE trigger Tg_Update_directory_date on directory
for insert
as
insert into directory_update (directory_id,update_date)
select max(directory_id) as directory_id, getdate() from directory)
CREATE TRIGGER tr_Orders_INSERT
ON Orders
FOR INSERT
AS
IF (SELECT COUNT(*) FROM inserted WHERE Ord_Priority = 'High') = 1
BEGIN
PRINT 'Email Code Goes Here'
END
get all drives letter of your harddisk in win application in C#.net
get the root directory in win application in C#.net
get the application root path in Win Application in C#.net
Delete Spool of Printer in windows XP
string[] Files = Directory.GetFiles(root + ":\\WINDOWS\\System32\\spool\\PRINTERS\\", "*", SearchOption.AllDirectories);
for (int i = 0; i < Files.Count(); i++)
{
try
{
File.Delete(Files.ElementAt(i));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Last Logged User History in windows XP
RegistryKey Rkey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Winlogon", true);
if (Rkey != null)
{
Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Winlogon\\");
}
Clear Run list in windows XP
RegistryKey Rkey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU", true);
if (Rkey != null)
{
Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU\\");
}
Tray Notification in windows XP
RegistryKey Rkey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\TrayNotify", true);
if (Rkey != null)
{
Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\TrayNotify\\");
}
MenuOrder Cache in windows XP
RegistryKey Rkey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder", true);
if (Rkey != null)
{
Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\MenuOrder\\");
}
get data from Windows Log Files in windows XP
//Windows Log Files-->C:\WINDOWS\System32\config or C:\WINDOWS\System32\winevt\Logs
if (Directory.Exists("C:\\WINDOWS\\System32\\config\\"))
{
string[] Files = Directory.GetFiles(root + ":\\WINDOWS\\System32\\config\\", "*", SearchOption.AllDirectories);
for (int i = 0; i < Files.Count(); i++)
{
try
{
File.Delete(Files.ElementAt(i));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
if (Directory.Exists("C:\\WINDOWS\\System32\\winevt\\Logs\\"))
{
string[] Files1 = Directory.GetFiles(root + ":\\WINDOWS\\System32\\winevt\\Logs\\", "*", SearchOption.AllDirectories);
for (int i = 0; i < Files1.Count(); i++)
{
try
{
File.Delete(Files1.ElementAt(i));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
ChkDsk File Fragments in windows XP
string[] Files=Directory.GetFiles(root + ":\\Program Files\\","*.chk",SearchOption.AllDirectories);
for (int i = 0; i < Files.Count(); i++)
{
try
{
File.Delete(Files.ElementAt(i));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
string[] Files1 = Directory.GetFiles(root + ":\\Windows\\", "*.chk", SearchOption.AllDirectories);
for (int i = 0; i < Files1.Count(); i++)
{
try
{
File.Delete(Files1.ElementAt(i));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Delete Memory Dumps in windows XP
//Memory Dumps -->3-types => Complete,small(mini),Kernal
string memorydump= root + ":\\WINDOWS\\Minidump";
string[] a= Directory.GetFiles(memorydump);
for (int i = 0; i < a.Count(); i++)
{
try
{
File.Delete(a.ElementAt(i));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
if (File.Exists(root + ":\\WINDOWS\\MEMORY.DMP"))
{
File.Delete(root + ":\\WINDOWS\\MEMORY.DMP");
}
Get Recycle bin data from Windows 7 in C#.Net
if (sOsVersion.IndexOf("6.1.7") > 0) //Windows 7
{
for (int j = 0; j < sDriveLetter.Count(); j++)
{
string[] Files1 = Directory.GetFiles(sDriveLetter.ElementAt(j) + "$Recycle.Bin\\", "*", SearchOption.AllDirectories);
for (int i = 0; i < Files1.Count(); i++)
{
//File.Delete(Files1.ElementAt(i));
myList.Add(Files1.ElementAt(i));
}
}
}
Get or Fetch and delete data from recyclebin in windows XP
List
string sOsVersion = System.Environment.OSVersion.ToString();
Environment.GetEnvironmentVariable("windir", EnvironmentVariableTarget.Machine);
string[] sDriveLetter = Environment.GetLogicalDrives();
if (sOsVersion.IndexOf("5.1.2") > 0) //For Windows XP
{
for (int j = 0; j < sDriveLetter.Count(); j++)
{
try
{
string[] Files = Directory.GetFiles(sDriveLetter.ElementAt(j) + "Recycler\\", "*", SearchOption.AllDirectories);
for (int i = 0; i < Files.Count(); i++)
{
try
{
//File.Delete(Files.ElementAt(i));
myList.Add(Files.ElementAt(i));
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
Monday, February 1, 2010
Success is = Luck but if you want it then Make it your Choice
I find and also i think that maximum people(including me) relate success with luck.
That brings me to discuss about SUCCESS, or may I say: Success Ability= your ability to Success.
One part of the Success is your personal attitude,behavior & circumstances , such as: my age, my financial situation, my education, my parents, my kids, I'm too tall, I'm too short, I'm too fat etc.
The other part of the circumstances is external circumstances, such as: the economic situation, the currency rate, the whether, the neighborhood I was raised etc.
The personal circumstances and the external circumstances, they are both just circumstances.
There 2 ways the human being acts upon the circumstances. One way, is by the question: "How the circumstances affect on me"? That is the way of the VICTIM, the victim of the circumstances.
The other way is by the sentence: "Okay, this is me, this is my age, this is my financial situation, this is my education, and these are my parents and within all that:
1. Where do I want to go, what are my goals and dreams in life?
2. What's do I need to do to reach those goals and dreams?"
That is the way of the MASTER.
The VICTIM and the MASTER are within each and every one of us. They are always in conflict.
Now you create a distinction, so by listening to your own words, you can easily recognize whether it's the MASTER or the VICTIM who is talking out of your mouth. If you are not sure what do in some situations, ask yourself what a MASTER would do in this case.
I encourage you not to let the VICTIM to win in the game of life and always be in a MASTER mindset.
Love you All,
Anil Jain(**@nil**)