hi I have developed my owen windows form, and instal different copies of it at different platforms i have istaled it at win 7 and xp it's work well but at windows 8 when i pring data from sql db to show at for edit or it gives me this error for all app :

System.ArgumentException: String was not recognized as a valid DateTime.
at LicensesProject.UpdateMediaProduction.returnDataFromDB() in D:\visual studio 2010 - 20-12-2014\projects\LicensesProject\LicensesProject\UpdateMediaProduction.cs:line 104
at LicensesProject.UpdateMediaProduction.UpdateMediaProduction_Load(Object sender, EventArgs e) in D:\visual studio 2010 - 20-12-2014\projects\LicensesProject\LicensesProject\UpdateMediaProduction.cs:line 25
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

what this mean ? and how to solve it ??

and when i creat crystal report it does not work, how to deal crystal report with win8

thanks to all

Hi

The exception is telling you that it does not recognise the string as a valid DateTime value and that it was thrown by this file: "D:\visual studio 2010 - 20-12-2014\projects\LicensesProject\LicensesProject\UpdateMediaProduction.cs" at line 104. So, what does the code look like for this file, specifically lines 25 and 104.

and when i creat crystal report it does not work, how to deal crystal report with win8

Does not work, is not very helpful I'm afraid. Do you get an exception? Do you get unexpected results? Does nothing happen at all?

go at UpdateMediaProduction.cs in line 25

copy and paste here what is in line 25 so that we will how the exact problem.

I believe the cause of this is a date format.

this code where error :

 private void returnDataFromDB()
        {
            SqlConnection conn = new DBConnection().Conn();
            SqlDataAdapter sda = null;
            DataSet da = null;

            try
            {
                SqlCommand sqlCMD = new SqlCommand("[dbo].[SelectMediaProduction]", conn);
                sqlCMD.CommandType = CommandType.StoredProcedure;

                sqlCMD.Parameters.Add(new SqlParameter("@ID", SqlDbType.BigInt, 50, "ID")).Value = Convert.ToInt32(SearchMediaProduction.selectedRow.Cells[0].Value);
                sda = new SqlDataAdapter(sqlCMD);
                da = new DataSet();
                sda.Fill(da);

                foreach (DataRow dr in da.Tables[0].Rows)
                {
                    /** Registration Fields **/
                    ID = Convert.ToInt32(dr["ID"]);
                    licenseNOTextBox.Text = dr["LicenseNO"].ToString();
                    registrationDateDateTimePicker.Value = Convert.ToDateTime(dr["RegistrationDate"].ToString());
                    registrationSignTextBox.Text = dr["RegistrationSign"].ToString();

                    /** Institute Fields **/
                    concessionaireTextBox.Text = dr["Concessionaire"].ToString();
                    concessionaireBirthPlaceTextBox.Text = dr["ConcessionaireBirthPlace"].ToString();
                    concessionaireBirthDateDateTimePicker.Value = Convert.ToDateTime(dr["ConcessionaireBirthDate"].ToString());
                    concessionaireNationalityTextBox.Text = dr["ConcessionaireNationality"].ToString();
                    concessionaireIdentityNoTextBox.Text = dr["ConcessionaireIdentityNo"].ToString();
                    instituteNameTextBox.Text = dr["InstituteName"].ToString();
                    concessionaireAddressTextBox.Text = dr["ConcessionaireAddress"].ToString();
                    concessionaireEmailTextBox.Text = dr["ConcessionaireEmail"].ToString();
                    concessionaireTeleTextBox.Text = dr["ConcessionaireTele"].ToString();
                    concessionaireFaxTextBox.Text = dr["ConcessionaireFax"].ToString();
                    concessionaireSignTextBox.Text = dr["ConcessionaireSign"].ToString();
                    concessionaireJawwalTextBox.Text = dr["ConcessionaireJawwal"].ToString();
                    submissionDateDateTimePicker.Value = Convert.ToDateTime(dr["SubmissionDate"].ToString());
                    concessionaireQualificationTextBox.Text = dr["ConcessionaireQualification"].ToString();
                    concessionaireExperienceTextBox.Text = dr["ConcessionaireExperience"].ToString();
                    instituteAddressTextBox.Text = dr["InstituteAddress"].ToString();
                    instituteDevicesTextBox.Text = dr["InstituteDevices"].ToString();
                    instituteTeleTextBox.Text = dr["InstituteTele"].ToString();
                    instituteFaxTextBox.Text = dr["InstituteFax"].ToString();
                    mediaProductionTypeTextBox.Text = dr["MediaProductionType"].ToString();
                    concessionaireResiduTextBox.Text = dr["ConcessionaireResidu"].ToString();

                    /** Incumbent Director **/
                    incumbentDirectorTextBox.Text = dr["IncumbentDirector"].ToString();
                    directorBirthDateDateTimePicker.Value = Convert.ToDateTime(dr["DirectorBirthDate"].ToString());
                    directorBirthPlaceTextBox.Text = dr["DirectorBirthPlace"].ToString();
                    directorResiduTextBox.Text = dr["DirectorResidu"].ToString();
                    directorExperienceTextBox.Text = dr["DirectorExperience"].ToString();
                    directorQualificationTextBox.Text = dr["DirectorQualification"].ToString();
                    directorNationalityTextBox.Text = dr["DirectorNationality"].ToString();
                    directorTeleTextBox.Text = dr["DirectorTele"].ToString();
                    directorFaxTextBox.Text = dr["DirectorFax"].ToString();
                    directorJawwalTextBox.Text = dr["DirectorJawwal"].ToString();

                    /** Notes **/
                    licenseDirectorNotesTextBox.Text = dr["LicenseDirectorNotes"].ToString();
                    licenseGeneralManagerNotesTextBox.Text = dr["LicenseGeneralManagerNotes"].ToString();
                    FileBytes = (byte[])dr["UploadFiles"];
                    FileBytes_0 = (byte[])dr["UploadFiles"];

                    /** Uploaded Files **/
                    //DownloadPDFFile(dr);
                    uploadFilesLinkTextBox.Text = "";
                }
            }
            catch (Exception ex)
            {
                throw new System.ArgumentException(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }

the line 104 : throw new System.ArgumentException(ex.Message);

and line 25 : returnDataFromDB();

paste the whole program of UpdateMediaProduction.cs.

start from the first using to the last curly brace (}) or apply the ctrl + a.

this is the whole program of UpdateMediaProduction.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Data.SqlClient;
using System.IO;

namespace LicensesProject
{
    public partial class UpdateMediaProduction : Form
    {
        public UpdateMediaProduction()
        {
            InitializeComponent();
        }

        private void UpdateMediaProduction_Load(object sender, EventArgs e)
        {
            ReloadLicensesType();
            returnDataFromDB();
        }

        byte[] FileBytes = new byte[64];
        byte[] FileBytes_0 = new byte[64];
        int ID = 0;

        private void returnDataFromDB()
        {
            SqlConnection conn = new DBConnection().Conn();
            SqlDataAdapter sda = null;
            DataSet da = null;

            try
            {
                SqlCommand sqlCMD = new SqlCommand("[dbo].[SelectMediaProduction]", conn);
                sqlCMD.CommandType = CommandType.StoredProcedure;

                sqlCMD.Parameters.Add(new SqlParameter("@ID", SqlDbType.BigInt, 50, "ID")).Value = Convert.ToInt32(SearchMediaProduction.selectedRow.Cells[0].Value);
                sda = new SqlDataAdapter(sqlCMD);
                da = new DataSet();
                sda.Fill(da);

                foreach (DataRow dr in da.Tables[0].Rows)
                {
                    /** Registration Fields **/
                    ID = Convert.ToInt32(dr["ID"]);
                    licenseNOTextBox.Text = dr["LicenseNO"].ToString();
                    registrationDateDateTimePicker.Value = Convert.ToDateTime(dr["RegistrationDate"].ToString());
                    registrationSignTextBox.Text = dr["RegistrationSign"].ToString();

                    /** Institute Fields **/
                    concessionaireTextBox.Text = dr["Concessionaire"].ToString();
                    concessionaireBirthPlaceTextBox.Text = dr["ConcessionaireBirthPlace"].ToString();
                    concessionaireBirthDateDateTimePicker.Value = Convert.ToDateTime(dr["ConcessionaireBirthDate"].ToString());
                    concessionaireNationalityTextBox.Text = dr["ConcessionaireNationality"].ToString();
                    concessionaireIdentityNoTextBox.Text = dr["ConcessionaireIdentityNo"].ToString();
                    instituteNameTextBox.Text = dr["InstituteName"].ToString();
                    concessionaireAddressTextBox.Text = dr["ConcessionaireAddress"].ToString();
                    concessionaireEmailTextBox.Text = dr["ConcessionaireEmail"].ToString();
                    concessionaireTeleTextBox.Text = dr["ConcessionaireTele"].ToString();
                    concessionaireFaxTextBox.Text = dr["ConcessionaireFax"].ToString();
                    concessionaireSignTextBox.Text = dr["ConcessionaireSign"].ToString();
                    concessionaireJawwalTextBox.Text = dr["ConcessionaireJawwal"].ToString();
                    submissionDateDateTimePicker.Value = Convert.ToDateTime(dr["SubmissionDate"].ToString());
                    concessionaireQualificationTextBox.Text = dr["ConcessionaireQualification"].ToString();
                    concessionaireExperienceTextBox.Text = dr["ConcessionaireExperience"].ToString();
                    instituteAddressTextBox.Text = dr["InstituteAddress"].ToString();
                    instituteDevicesTextBox.Text = dr["InstituteDevices"].ToString();
                    instituteTeleTextBox.Text = dr["InstituteTele"].ToString();
                    instituteFaxTextBox.Text = dr["InstituteFax"].ToString();
                    mediaProductionTypeTextBox.Text = dr["MediaProductionType"].ToString();
                    concessionaireResiduTextBox.Text = dr["ConcessionaireResidu"].ToString();

                    /** Incumbent Director **/
                    incumbentDirectorTextBox.Text = dr["IncumbentDirector"].ToString();
                    directorBirthDateDateTimePicker.Value = Convert.ToDateTime(dr["DirectorBirthDate"].ToString());
                    directorBirthPlaceTextBox.Text = dr["DirectorBirthPlace"].ToString();
                    directorResiduTextBox.Text = dr["DirectorResidu"].ToString();
                    directorExperienceTextBox.Text = dr["DirectorExperience"].ToString();
                    directorQualificationTextBox.Text = dr["DirectorQualification"].ToString();
                    directorNationalityTextBox.Text = dr["DirectorNationality"].ToString();
                    directorTeleTextBox.Text = dr["DirectorTele"].ToString();
                    directorFaxTextBox.Text = dr["DirectorFax"].ToString();
                    directorJawwalTextBox.Text = dr["DirectorJawwal"].ToString();

                    /** Notes **/
                    licenseDirectorNotesTextBox.Text = dr["LicenseDirectorNotes"].ToString();
                    licenseGeneralManagerNotesTextBox.Text = dr["LicenseGeneralManagerNotes"].ToString();
                    FileBytes = (byte[])dr["UploadFiles"];
                    FileBytes_0 = (byte[])dr["UploadFiles"];

                    /** Uploaded Files **/
                    //DownloadPDFFile(dr);
                    uploadFilesLinkTextBox.Text = "";
                }
            }
            catch (Exception ex)
            {
                throw new System.ArgumentException(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }

        private void updateButton_Click(object sender, EventArgs e)
        {
            if (!licensesTypeComboBox.SelectedValue.Equals(1))
            {
                if (!licenseNOTextBox.Text.Trim().Equals("") & !registrationSignTextBox.Text.Trim().Equals("") & !concessionaireTextBox.Text.Trim().Equals("")
                    & !concessionaireAddressTextBox.Text.Trim().Equals("") & !concessionaireExperienceTextBox.Text.Trim().Equals("") & !instituteDevicesTextBox.Text.Trim().Equals("")
                    & !concessionaireTeleTextBox.Text.Trim().Equals("") & !concessionaireFaxTextBox.Text.Trim().Equals("") & !concessionaireJawwalTextBox.Text.Trim().Equals("")
                    & !concessionaireSignTextBox.Text.Trim().Equals("") & !instituteNameTextBox.Text.Trim().Equals("") & !concessionaireEmailTextBox.Text.Trim().Equals("")
                    & !incumbentDirectorTextBox.Text.Trim().Equals("") & !directorBirthPlaceTextBox.Text.Trim().Equals("") & !directorResiduTextBox.Text.Trim().Equals("")
                    & !directorExperienceTextBox.Text.Trim().Equals("") & !directorQualificationTextBox.Text.Trim().Equals("") & !directorNationalityTextBox.Text.Trim().Equals("")
                    & !directorTeleTextBox.Text.Trim().Equals("") & !directorFaxTextBox.Text.Trim().Equals("") & !licenseDirectorNotesTextBox.Text.Trim().Equals("") & !mediaProductionTypeTextBox.Text.Trim().Equals("")
                    & !licenseGeneralManagerNotesTextBox.Text.Trim().Equals("") & !instituteFaxTextBox.Text.Trim().Equals("") & !instituteTeleTextBox.Text.Trim().Equals(""))
                {
                    if (!Duplication.IsValidEmail(concessionaireEmailTextBox.Text.Trim()))
                    {
                        alertLabel.ForeColor = Color.Red;
                        alertLabel.Text = " الرجاء التأكد من صحة البريد الإلكتروني المدخل ...";
                        return;
                    }
                    else if (!Duplication.IsValidNumber(concessionaireTeleTextBox.Text.Trim()) || !Duplication.IsValidNumber(concessionaireFaxTextBox.Text.Trim())
                            || !Duplication.IsValidNumber(directorTeleTextBox.Text.Trim()) || !Duplication.IsValidNumber(directorFaxTextBox.Text.Trim())
                            || !Duplication.IsValidNumber(instituteTeleTextBox.Text.Trim()) || !Duplication.IsValidNumber(instituteFaxTextBox.Text.Trim()))
                    {
                        alertLabel.ForeColor = Color.Red;
                        alertLabel.Text = "الرجاء التأكد من صحة أرقام الهواتف والفاكسات المدخلة بحيث تتكون من أرقام فقط ...";
                        return;
                    }
                    else
                    {
                        SqlConnection conn = new DBConnection().Conn();


                        try
                        {
                            if (!uploadFilesLinkTextBox.Text.Trim().Equals(""))
                            {
                                uploadPDFFiles();
                            }
                            if (!concessionaireJawwalTextBox.Text.Trim().Equals("") || !directorJawwalTextBox.Text.Trim().Equals(""))
                            {
                                if (!Duplication.IsValidNumber(concessionaireJawwalTextBox.Text.Trim()) || !Duplication.IsValidNumber(directorJawwalTextBox.Text.Trim()))
                                {
                                    alertLabel.ForeColor = Color.Red;
                                    alertLabel.Text = "الرجاء التأكد من صحة أرقام الهواتف والفاكسات المدخلة بحيث تتكون من أرقام فقط ...";
                                    return;
                                }
                            }
                            else
                            {
                                concessionaireJawwalTextBox.Text = "0";
                                directorJawwalTextBox.Text = "0";
                            }

                            SqlCommand sqlCMD = new SqlCommand("[dbo].[UpdateMediaProduction]", conn);
                            sqlCMD.CommandType = CommandType.StoredProcedure;

                            sqlCMD.Parameters.Add(new SqlParameter("@ID", SqlDbType.Int, 50, "ID")).Value = ID;

                            sqlCMD.Parameters.Add(new SqlParameter("@LicenseTypeID", SqlDbType.Int, 50, "LicenseTypeID")).Value = licensesTypeComboBox.SelectedValue;
                            sqlCMD.Parameters.Add(new SqlParameter("@LicenseNO", SqlDbType.NVarChar, 50, "LicenseNO")).Value = licenseNOTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@RegistrationDate", SqlDbType.NVarChar, 50, "RegistrationDate")).Value = registrationDateDateTimePicker.Value.Date.ToString("MM/dd/yyyy");
                            sqlCMD.Parameters.Add(new SqlParameter("@RegistrationSign", SqlDbType.NVarChar, 50, "RegistrationSign")).Value = registrationSignTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@Concessionaire", SqlDbType.NVarChar, 50, "Concessionaire")).Value = concessionaireTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireBirthDate", SqlDbType.NVarChar, 50, "ConcessionaireBirthDate")).Value = concessionaireBirthDateDateTimePicker.Value.Date.ToString("MM/dd/yyyy");
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireBirthPlace", SqlDbType.NVarChar, 50, "ConcessionaireBirthPlace")).Value = concessionaireBirthPlaceTextBox.Text.Trim();

                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireNationality", SqlDbType.NVarChar, 50, "ConcessionaireNationality")).Value = concessionaireNationalityTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireIdentityNo", SqlDbType.NVarChar, 50, "ConcessionaireIdentityNo")).Value = concessionaireIdentityNoTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireAddress", SqlDbType.NVarChar, 50, "ConcessionaireAddress")).Value = concessionaireAddressTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireResidu", SqlDbType.NVarChar, 50, "ConcessionaireResidu")).Value = concessionaireResiduTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireQualification", SqlDbType.NVarChar, 550, "ConcessionaireQualification")).Value = concessionaireQualificationTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireExperience", SqlDbType.NVarChar, 550, "ConcessionaireExperience")).Value = concessionaireExperienceTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireTele", SqlDbType.NVarChar, 50, "ConcessionaireTele")).Value = concessionaireTeleTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireFax", SqlDbType.NVarChar, 50, "ConcessionaireFax")).Value = concessionaireFaxTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireJawwal", SqlDbType.NVarChar, 50, "ConcessionaireJawwal")).Value = concessionaireJawwalTextBox.Text.Trim();

                            sqlCMD.Parameters.Add(new SqlParameter("@InstituteName", SqlDbType.NVarChar, 50, "InstituteName")).Value = instituteNameTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireEmail", SqlDbType.NVarChar, 50, "ConcessionaireEmail")).Value = concessionaireEmailTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@InstituteAddress", SqlDbType.NVarChar, 50, "InstituteAddress")).Value = instituteAddressTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@MediaProductionType", SqlDbType.NVarChar, 50, "MediaProductionType")).Value = mediaProductionTypeTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@InstituteDevices", SqlDbType.NVarChar, 50, "InstituteDevices")).Value = instituteDevicesTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@InstituteTele", SqlDbType.NVarChar, 50, "InstituteTele")).Value = instituteTeleTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@InstituteFax", SqlDbType.NVarChar, 50, "InstituteFax")).Value = instituteFaxTextBox.Text.Trim();

                            sqlCMD.Parameters.Add(new SqlParameter("@IncumbentDirector", SqlDbType.NVarChar, 50, "IncumbentDirector")).Value = incumbentDirectorTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorBirthDate", SqlDbType.NVarChar, 50, "DirectorBirthDate")).Value = directorBirthDateDateTimePicker.Value.Date.ToString("MM/dd/yyyy");
                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorBirthPlace", SqlDbType.NVarChar, 50, "DirectorBirthPlace")).Value = directorBirthPlaceTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorTele", SqlDbType.NVarChar, 50, "DirectorTele")).Value = directorTeleTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorFax", SqlDbType.NVarChar, 50, "DirectorFax")).Value = directorFaxTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorJawwal", SqlDbType.NVarChar, 50, "DirectorJawwal")).Value = directorJawwalTextBox.Text.Trim();

                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorResidu", SqlDbType.NVarChar, 50, "DirectorResidu")).Value = directorResiduTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorNationality", SqlDbType.NVarChar, 50, "DirectorNationality")).Value = directorNationalityTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorQualification", SqlDbType.NVarChar, 50, "DirectorQualification")).Value = directorQualificationTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@DirectorExperience", SqlDbType.NVarChar, 50, "DirectorExperience")).Value = directorExperienceTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@SubmissionDate", SqlDbType.NVarChar, 50, "SubmissionDate")).Value = submissionDateDateTimePicker.Value.Date.ToString("MM/dd/yyyy");
                            sqlCMD.Parameters.Add(new SqlParameter("@ConcessionaireSign", SqlDbType.NVarChar, 50, "ConcessionaireSign")).Value = concessionaireSignTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@LicenseDirectorNotes", SqlDbType.NVarChar, 225, "LicenseDirectorNotes")).Value = licenseDirectorNotesTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@LicenseGeneralManagerNotes", SqlDbType.NVarChar, 255, "LicenseGeneralManagerNotes")).Value = licenseGeneralManagerNotesTextBox.Text.Trim();
                            sqlCMD.Parameters.Add(new SqlParameter("@UploadFiles", SqlDbType.VarBinary, Convert.ToInt32(FileBytes.Length), "UploadFiles")).Value = FileBytes;


                            sqlCMD.ExecuteNonQuery();
                            alertLabel.ForeColor = Color.Green;
                            alertLabel.Text = "لقد تم إضافة طلب ترخيص جديد";
                        }
                        catch (Exception exc)
                        {
                            throw new System.ArgumentException(exc.Message);
                        }
                        finally
                        {
                            if (conn != null)
                            {
                                conn.Close();
                            }
                        }
                    }
                }
                else
                {
                    alertLabel.ForeColor = Color.Red;
                    alertLabel.Text = "الرجاءإدخال جميع حقول طلب الترخيص...";
                    return;
                }
            }
            else
            {
                alertLabel.ForeColor = Color.Red;
                alertLabel.Text = "الرجاءإختيار نوع طلب الترخيص...";
                return;
            }
        }

        private void closeButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void ReloadLicensesType()
        {
            SqlConnection conn = new DBConnection().Conn();
            SqlDataAdapter sda = null;
            SqlDataReader sdr = null;
            DataSet da = null;

            try
            {
                SqlCommand sqlCMD = new SqlCommand("[dbo].[FillDataSetLicensesType]", conn);
                sqlCMD.CommandType = CommandType.StoredProcedure;
                sda = new SqlDataAdapter(sqlCMD);
                da = new DataSet();
                sda.Fill(da);

                licensesTypeComboBox.DataSource = da.Tables[0].DefaultView;
                licensesTypeComboBox.DisplayMember = "LicenseType";
                licensesTypeComboBox.ValueMember = "ID";

            }
            catch (Exception exc)
            {
                throw new System.ArgumentException(exc.Message);
            }
            finally
            {
                if (conn != null || sdr != null)
                {
                    conn.Close();
                }
            }
        }

        private void uploadPDFFiles()
        {
            string filetype;
            string filename;

            filename = uploadFilesLinkTextBox.Text.Substring(Convert.ToInt32(uploadFilesLinkTextBox.Text.LastIndexOf("\\")) + 1, uploadFilesLinkTextBox.Text.Length - (Convert.ToInt32(uploadFilesLinkTextBox.Text.LastIndexOf("\\")) + 1));
            filetype = uploadFilesLinkTextBox.Text.Substring(Convert.ToInt32(uploadFilesLinkTextBox.Text.LastIndexOf(".")) + 1, uploadFilesLinkTextBox.Text.Length - (Convert.ToInt32(uploadFilesLinkTextBox.Text.LastIndexOf(".")) + 1));

            //MessageBox.Show(filename + " " + filetype);

            //Validate user upload only specific bytes - un comment below lines if you need to validate only PDF files

            if (filetype.ToUpper() != "PDF")
            {
                alertLabel.ForeColor = Color.Red;
                alertLabel.Text = "الرجاء إدخال ملف PDF فقط ...";
                return;
            }

            try
            {
                // Open file to read using file path
                FileStream FS = new FileStream(uploadFilesLinkTextBox.Text, System.IO.FileMode.Open, System.IO.FileAccess.Read);

                // Add filestream to binary reader
                BinaryReader BR = new BinaryReader(FS);

                // get total byte length of the file
                long allbytes = new FileInfo(uploadFilesLinkTextBox.Text).Length;

                // read entire file into buffer
                FileBytes = BR.ReadBytes((Int32)allbytes);

                // close all instances
                FS.Close();
                FS.Dispose();
                BR.Close();
            }
            catch (Exception ex)
            {
                alertLabel.Text = "Error during File Read " + ex.ToString();
                //MessageBox.Show("Error during File Read " + ex.ToString());
            }

            //Store File Bytes in database image filed 

            //    sqlcon.Open();
            //    SqlCommand sqlcmd = new SqlCommand("insert into PDFupload(fname,fcontent) values (@FN, @FB)", sqlcon);
            //    sqlcmd.Parameters.AddWithValue("@FN", filename);
            //    sqlcmd.Parameters.AddWithValue("@FB", FileBytes);
        }

        private void DownloadPDFFile()
        {
            FileStream FS = null;
            byte[] dbbyte;

            try
            {
                //Get a stored PDF bytes
                dbbyte = FileBytes_0;

                //store file Temporarily 
                string filepath = @"C:\Downloads\PDF_0.pdf";

                //Create folder to download file
                System.IO.Directory.CreateDirectory(@"C:\Downloads");

                //create file to download byte stream into it


                //Assign File path create file
                FS = new FileStream(filepath, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);

                //Write bytes to create file

                FS.Write(dbbyte, 0, dbbyte.Length);
                FS.Flush();
                FS.Close();

                //Open file after write

                //Create instance for process class
                Process Proc = new Process();

                //assign file path for process
                Proc.StartInfo.FileName = filepath;
                Proc.Start();

            }
            catch (Exception ex)
            {
                throw new System.ArgumentException(ex.Message);
            }
        }

        private void showPDFLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            DownloadPDFFile();
        }

        private void uploadFilesLinkButton_Click(object sender, EventArgs e)
        {
            openFileDialog1.Title = "Select file to be upload";
            //openFileDialog1.Filter = "PDF Files|*.pdf|All Files|*.*";
            openFileDialog1.Filter = "PDF Files|*.pdf";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                uploadFilesLinkTextBox.Text = openFileDialog1.FileName.ToString();
            }
            uploadPDFFiles();
        }

    }
}

this code work well at win xp and win 7 but does not work at win 8 this my problem .....

Thanks ....

check all datepicker. the problem is there.

ex.

datepicker = a;

the date format of a is incorrect.

but it's work well at win xp and win 7 why not at win 8 ??

the date formate is incorrect

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.