About

Mohammad Elsheimy

Mohammad Elsheimy is a Microsoft developer, trainer, and technical writer currently hired by The Continental School of Cairo as solution developer.

Mohammad is a MCP, MCTS, MCPD, MCSA, MCSE, and MCT expertized in .NET Framework technologies, data management and analytics. He is a Quranic Readings Institute (Al-Azhar) graduate specialized in Quranic readings, Islamic legislation, and the Arabic language.

Mohammad was born in 1991 in Banha, Egypt. He loves his machine and his code more than anything else!

Currently, he runs 3 blogs:

Check out Mohammad’s portfolio here: http://elsheimy.com

You can reach Mohammad at elsheimy[at]live[dot]com

  • Raysdoc62

    I have a question about your SimpleRec for C#.  I can run the sample on one of my Win 7 Ultimate computers but not the other.  I get the following error: No wave device is installed that can record files in the current format….”  I uninstalled all my audio devices and reinstalled.  I have applied all Microsoft updates and Dell BIOS, etc…updates.  Any thoughts why this may be occuring? 

  • Don Munsil

    Hi Mohammad,

    I’m a compatibility

  • Hakim

    Assalamo Allaykom
    My name is Hakim, I live and work in Canada.
    I want to contact you about a bug in my application in WPF.
    Can you help me please.
    Thank you
    Salam

  • Mosaed Alzamil

    حفظك الله

  • Pingback: Anonymous()

  • Asim

    Thanks, you helped me a lot with your blog
    Greetings from Bosnia and Hercegovina

  • BALAJI

    HI,
    i have seen ur article about how to send mails from our windows application…

    actually i downloaded ur application source code and try to use it but i got few runtime because of i was working in proxy enabled machine

    after i turn it off it worked once but after i did not worked and i throws error like”smtp unhandeld exception”

    my coding is

    name spaces are

    using system.net.mail;
    using System.Net.Mime;
     private void button1_Click(object sender, EventArgs e)
            {
                try
                {
                    SmtpClient server = new SmtpClient();
                    server.Credentials = new System.Net.NetworkCredential("xxxx@gmail.com", "password");
                    server.UseDefaultCredentials = false;
                    server.Port = 25;
                    server.Host = "smtp.gmail.com";
                    server.EnableSsl = true;
                    MailMessage message = new MailMessage("xxxx@gmail.com", "yyyy@rediffmail.com");
                    message.Body = "i love u";
                    message.Priority = MailPriority.High;
                    message.Subject = "my own mail ide";
                    server.Send(message);
                }
                catch (SystemException SE)
                {
                    MessageBox.Show(SE.ToString());
                }
            }

    and i’m gettin error is

    System.Net.Mail.SmtpException was unhandled
      Message="Failure sending mail."
      Source="System"
      StackTrace:
           at System.Net.Mail.SmtpClient.Send(MailMessage message)
           at Gmail.Form1.Button1_Click(Object sender, EventArgs e)
                in C:\CoolCode_srcC_\Gmail\Gmail\Form1.cs:line 45
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ButtonBase.WndProc(Message& m)
           at System.Windows.Forms.Button.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.
                DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.
                UnsafeNativeMethods.IMsoComponentManager.
                FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.
                RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.
                RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at Gmail.Program.Main() in C:\CoolCode_srcC_\Gmail\Gmail\Program.cs:line 17
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run
                (ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()

    pls tell to resolve tis problem man.i’m trying tis from last 1 month ….

    i’m waiting for ur reply …reply me as soon as possible

    • Please provide more details (e.g. InnerException).

      This should work fine:

      private void button1_Click(object sender, EventArgs e)
      {
          try
          {
              SmtpClient server = new SmtpClient();
              server.Credentials =
                  new System.Net.NetworkCredential("xxxx@gmail.com", "password");
              server.UseDefaultCredentials = false;
              server.Port = 25;
              server.Host = "smtp.gmail.com";
              server.EnableSsl = true;
              server.DeliveryMethod = SmtpDeliveryMethod.Network;
              MailMessage message =
                  new MailMessage("xxxx@gmail.com", "yyyy@rediffmail.com");
              message.Body = "i love u";
              message.Priority = MailPriority.High;
              message.Subject = "my own mail ide";
              server.Send(message);
          }
          catch (SmtpException SE)
          {
              MessageBox.Show(SE.ToString());
          }
      }

      1st. You you should set the SmtpClient.DeliveryMethod to SmtpDeliveryMethod.Network

      2nd. Never ever catch Exception, ApplicationException, or SystemException. You should handle that specific exceptions.

  • BALAJI

    HI,
    i have seen ur article about how to send mails from our windows application…

    actually i downloaded ur application source code and try to use it but i got few runtime because of i was working in proxy enabled machine

    after i turn it off it worked once but after i did not worked and i throws error like”smtp unhandeld exception”

    my coding is

    name spaces are

    using system.net.mail;
    using System.Net.Mime;
     private void button1_Click(object sender, EventArgs e)
            {
                try
                {
                    SmtpClient server = new SmtpClient();
                    server.Credentials = new System.Net.NetworkCredential("xxxx@gmail.com", "password");
                    server.UseDefaultCredentials = false;
                    server.Port = 25;
                    server.Host = "smtp.gmail.com";
                    server.EnableSsl = true;
                    MailMessage message = new MailMessage("xxxx@gmail.com", "yyyy@rediffmail.com");
                    message.Body = "i love u";
                    message.Priority = MailPriority.High;
                    message.Subject = "my own mail ide";
                    server.Send(message);
                }
                catch (SystemException SE)
                {
                    MessageBox.Show(SE.ToString());
                }
            }

    and i’m gettin error is

    System.Net.Mail.SmtpException was unhandled
      Message="Failure sending mail."
      Source="System"
      StackTrace:
           at System.Net.Mail.SmtpClient.Send(MailMessage message)
           at Gmail.Form1.Button1_Click(Object sender, EventArgs e)
                in C:CoolCode_srcC_GmailGmailForm1.cs:line 45
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ButtonBase.WndProc(Message& m)
           at System.Windows.Forms.Button.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.
                DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.
                UnsafeNativeMethods.IMsoComponentManager.
                FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.
                RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.
                RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at Gmail.Program.Main() in C:CoolCode_srcC_GmailGmailProgram.cs:line 17
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run
                (ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()

    pls tell to resolve tis problem man.i’m trying tis from last 1 month ….

    i’m waiting for ur reply …reply me as soon as possible

    • Please provide more details (e.g. InnerException).

      This should work fine:

      private void button1_Click(object sender, EventArgs e)
      {
          try
          {
              SmtpClient server = new SmtpClient();
              server.Credentials =
                  new System.Net.NetworkCredential("xxxx@gmail.com", "password");
              server.UseDefaultCredentials = false;
              server.Port = 25;
              server.Host = "smtp.gmail.com";
              server.EnableSsl = true;
              server.DeliveryMethod = SmtpDeliveryMethod.Network;
              MailMessage message =
                  new MailMessage("xxxx@gmail.com", "yyyy@rediffmail.com");
              message.Body = "i love u";
              message.Priority = MailPriority.High;
              message.Subject = "my own mail ide";
              server.Send(message);
          }
          catch (SmtpException SE)
          {
              MessageBox.Show(SE.ToString());
          }
      }

      1st. You you should set the SmtpClient.DeliveryMethod to SmtpDeliveryMethod.Network

      2nd. Never ever catch Exception, ApplicationException, or SystemException. You should handle that specific exceptions.

  • Thanks, Hwedy
    You were so great
    But, I don’t prefer Microsoft all the time.
    I think Microsoft is taking the approach “pay-as-you-go,” and I hate that approach.
    I love Linux too much, also I prefer some other Microsoft products.
    But, sure I’m a great fan of Microsoft, and of course other technology industries

  • Thanks, Hwedy
    You were so great
    But, I don’t prefer Microsoft all the time.
    I think Microsoft is taking the approach “pay-as-you-go,” and I hate that approach.
    I love Linux too much, also I prefer some other Microsoft products.
    But, sure I’m a great fan of Microsoft, and of course other technology industries

  • Al salamo alykom,
    Hi Mohammed how are you,
    Great to have a target to achieve, great to insist on, but not great to make your target to be another Microsoft fan!!

    I don’t hate Microsoft, or love it, But Technology != Microsoft any way.

    Try to look outside Microsoft’s circle, there is yet another world.
    What i get annoyed from some of friends who are MS fans that, they don’t see more or less than Microsoft. but again, there is a garden world outside MS barriers. Just try to discover that world.

    Best Wished from Egyptian, arabic, Moslem brother,

    Have fun.

  • Al salamo alykom,
    Hi Mohammed how are you,
    Great to have a target to achieve, great to insist on, but not great to make your target to be another Microsoft fan!!

    I don’t hate Microsoft, or love it, But Technology != Microsoft any way.

    Try to look outside Microsoft’s circle, there is yet another world.
    What i get annoyed from some of friends who are MS fans that, they don’t see more or less than Microsoft. but again, there is a garden world outside MS barriers. Just try to discover that world.

    Best Wished from Egyptian, arabic, Moslem brother,

    Have fun.