শনিবার, ১৫ অক্টোবর, ২০১১

Shutdown, Logoff, Restart Code in VB 6

Shutdown কমান্ড বাটনে ডাবল ক্লিক করে Private Sub Command1_Click () এবং End Sub এই লাইন দুটির মাঝখানে নিচের সুত্র/ সংকেত লিখুন:
Shell ("Shutdown -s")
এবার আগের মত করে Logoff কমান্ড বাটনে ডবল ক্লিক করে লিখুন:
Shell ("Shutdown -l")
এবং Restart কমান্ড বাটনে ডবল ক্লিক করে লিখুন:
Shell ("Shutdown -r")
এবার Alt+F+K চেপে নাম দিয়ে সেভ করুন। ব্যাস হয়ে গেল।

How to use the Speech Synthesizer in WPF

Simply add a reference to System.Speech and include the following code to your project.


 
using System.Speech.Synthesis;
 
SpeechSynthesizer synthesizer = new SpeechSynthesizer(); 
synthesizer.Volume = 50;  // 0...100
synthesizer.Rate = 3;     // -10...10
 
// Synchronous
synthesizer.Speak("Welcome to the WPF.");
 
// Asynchronous
synthesizer.SpeakAsync("Welcome to the WPF.");

বৃহস্পতিবার, ৭ এপ্রিল, ২০১১

SQL Database File Attach command

USE master;
GO
CREATE DATABASE MyDatabase 
    ON (FILENAME = 'C:\MySQLServer\Mydata_Data.mdf'),
    (FILENAME = 'C:\MySQLServer\Mydata_Log.ldf')
    FOR ATTACH;
GO

SQL Database Backup And restore command

BACKUP COMMAND
BACKUP DATABASE  [DbName] TO DISK='C:\Db.BAK';

 RESTORE COMMAND
RESTORE DATABASE [DbName] FROM DISK = N'C:\Db.BAK' WITH FILE = 1, MOVE N'DbName_dat' TO N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DbName_data.mdf', MOVE N'DbName_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\DbName_log.ldf', NOUNLOAD, REPLACE, STATS = 10
GO

Month number to Month String Convert in c sharp

 private static string GetMonthName(int month, bool test)
       {

           DateTime date = new DateTime(1900, month, 1);

           if (test)
          {
              return date.ToString("MMM");
          }
         else
        {
           return date.ToString("MMMM");
        }
    }

সোমবার, ৪ এপ্রিল, ২০১১

File read and Write in C#

 File Write in C#
 StreamWriter writer = new StreamWriter("Filename.txt");
  writer.WriteLine("some string");
   writer.Close();

File Read in C#
 StreamReader reader = new StreamReader("Filename.txt");
 string text= reader.ReadLine();          
 reader.Close();