Execute cmd commands using C#

Hello again , 
If you want to execute cmd commands from c# you can use this method : 

private void ExecuteCommand(string Command)
{
    ProcessStartInfo ProcessInfo;
    Process Process;

    ProcessInfo = new ProcessStartInfo("cmd.exe", "/C " + Command);
    ProcessInfo.CreateNoWindow = false;
    ProcessInfo.UseShellExecute = false;
    Process = Process.Start(ProcessInfo);
    Process.WaitForExit();

    Process.Close();
}

If you like to execute multi commands in the same process you can just seperate each one with "&"

like this : 


ExecuteCommand("cd\ & myApp.exe");

where "cd\" is the first command and "myApp.exe" is the second one.

Enjoy it..


كيفية اتصال برنامج جافا بقاعدة البيانات أوراكل

ربط الجافا مع قاعدة البيانات أوراكل

سنتناول اليوم طريقة ربط برنامج مكتوب بلغة الجافا مع قاعدة البيانات أوراكل .

قبل أن نبدأ علينا أن نعرف أنه لكي يتمكن أي برنامج جافا من الاتصال بقاعدة البيانات أوراكل يجب أن يتوفر driver خاص اسمه jdbc والذي يهتم بإدارة عمليات الاتصال والاستعلامات وغيرها من العمليات مع القاعدة.. المهم يمكن تحميله من موقع أوراكل مباشرة باتباع الرابط التالي واختيار مدير القاعدة المناسب :

http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html

Continue reading

Key down event

Hello there..

If you want to execute a code when press a key, this code is what you want

// Handle the KeyDown event to determine the type of character entered into the control.
private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
   if (e.KeyCode ==Keys.Enter)
     {
        // do some thing
     }
}

Enjoy it...