当前位置: 首页>>代码示例>>C#>>正文


C# MessageBox.Show方法代码示例

本文整理汇总了C#中MessageBox.Show方法的典型用法代码示例。如果您正苦于以下问题:C# MessageBox.Show方法的具体用法?C# MessageBox.Show怎么用?C# MessageBox.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MessageBox的用法示例。


在下文中一共展示了MessageBox.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeMCVersion

        public ChangeMCVersion()
        {
            InitializeComponent();
            try
            {
                foreach (TinyMinecraftVersion ver in VersionManager.versions)
                {
                    ListBoxItem item = new ListBoxItem();
                    item.Content = ver.Key;
                    item.Tag = ver;

                    if (ver.Type == ReleaseType.release)
                        lb_release.Items.Add(item);
                    else if (ver.Type == ReleaseType.snapshot)
                        lb_snapshot.Items.Add(item);
                    else
                        lb_instance.Items.Add(item);
                }
            }
            catch
            {
                MessageBox mb = new MessageBox("Warning!","The versions haven't initialized yet");
                mb.Show();
                this.Close();
            }
        }
开发者ID:Northcode,项目名称:MCM-reboot,代码行数:26,代码来源:ChangeMCVersion.xaml.cs

示例2: Show

 public static void Show(string text)
 {
     MessageBox mb = new MessageBox();
     mb.lblText.Text = text;
     MainForm.Enabled = false;
     mb.Show(MainForm);
     mb.Location = new Point((MainForm.Width / 2) - (mb.Width / 2), (MainForm.Height / 2) - (mb.Height / 2));
 }
开发者ID:ErichDonGubler,项目名称:uvschess,代码行数:8,代码来源:MessageBox.cs

示例3: Button_Click

 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (version != null)
     {
         this.DialogResult = true;
         this.Close();
     }
     else
     {
         MessageBox mb = new MessageBox("Warning","Please select a version or press cancel!");
         mb.Show();
     }
 }
开发者ID:Northcode,项目名称:MCM-reboot,代码行数:13,代码来源:ChangeMCVersion.xaml.cs

示例4: fill

    public void fill()
    {
        try
        {
            gv_events.DataSource=sedb.getall();
            gv_events.DataBind();

        }
        catch
        {
            CustomException ex = new CustomException("Error !!!", "Data can not be loaded to page");
            MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
            messageBox.Show(this);

        }
    }
开发者ID:neonmax,项目名称:sims,代码行数:16,代码来源:H_School_eventUD.aspx.cs

示例5: fill

 //fill the drivview with table data
 public void fill()
 {
     try
     {
         //invoke the methode to retrive the record from the table
         gv_warning.DataSource = swdb.databind();
         gv_warning.DataBind();
     }
     catch (Exception dd)
     {
         //popout custom message if any error happans
         CustomException ex = new CustomException("Error !!!", "warning details can not be retrived");
         MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
         messageBox.Show(this);
     }
 }
开发者ID:neonmax,项目名称:sims,代码行数:17,代码来源:Warning_UD.aspx.cs

示例6: fill_ddl_subevents

 //fill the dropdown list with all sub events
 public void fill_ddl_subevents(string master)
 {
     try
     {
         //invoe get all grade methode
         ddl_sub.DataSource = sedc.get_subevents(master);
         ddl_sub.DataMember = "EVENT_TYPE_SUB";
         ddl_sub.DataValueField = "EVENT_TYPE_SUB";
         ddl_sub.DataBind();
     }
     catch
     {
         //Response.Write("<script>alert('sub event details can not be loaded')</script>");
         CustomException ex = new CustomException("Error !!!", "event sub details can not be loaded");
         MessageBox messages = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
         messages.Show(this);
     }
 }
开发者ID:neonmax,项目名称:sims,代码行数:19,代码来源:H_School_Event.aspx.cs

示例7: fill

    //invoke the methode to get all table records
    public void fill()
    {
        try
        {
            //invoke the get all methde
            gv_events.DataSource = sedb.getall();
            gv_events.DataBind();

        }
        catch
        {
            //promt error meesage is any exception happens
            CustomException ex = new CustomException("Error !!!", "Data can not be loaded to page");
            MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
            messageBox.Show(this);

        }
    }
开发者ID:neonmax,项目名称:sims,代码行数:19,代码来源:School_Event_UD.aspx.cs

示例8: fill_ddl_activtycode

 //fill the drop down list with activty codes
 public void fill_ddl_activtycode()
 {
     try
     {
         //invoke get all activityes methode
         ddl_type.DataSource = ialdc.getall_activity_type();
         ddl_type.DataMember = "ACTIVITY_CODE";
         ddl_type.DataValueField = "ACTIVITY_CODE";
         ddl_type.DataBind();
     }
     catch
     {
         //Response.Write("<script>alert('activty code details can not be loaded')</script>");
         ////popout custom message if any error happans
         CustomException ex = new CustomException("Error!!!", "activty code details can not be loaded");
         MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
         messageBox.Show(this);
     }
 }
开发者ID:neonmax,项目名称:sims,代码行数:20,代码来源:Activity_Log.aspx.cs

示例9: fillclass

    //fill the ddl_class with selected grade
    public void fillclass(decimal grade)
    {
        try
        {
            //invoke the methode to retrive the class details according to the selected grade
            ddl_class.DataSource = swdb.get_class_relevaent_grade(grade);
            ddl_class.DataMember = "CLASS_CODE";
            ddl_class.DataValueField = "CLASS_CODE";
            ddl_class.DataBind();

        }
        catch (Exception ss)
        {
            //popout custom message if any error happans
            CustomException ex = new CustomException("Error !!!", "class detals can not retrived");
            MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
            messageBox.Show(this);

        }
    }
开发者ID:neonmax,项目名称:sims,代码行数:21,代码来源:Warning_UD.aspx.cs

示例10: validate_date

    //validate the selected date
    public bool validate_date(string date)
    {
        int selected_date = 0;
        try
        {

            //hold the current date  and month
            string format = date.Substring(3, 1);
            int this_month = Convert.ToInt32(DateTime.Today.Month.ToString());
            int today = Convert.ToInt32(DateTime.Today.Day.ToString());
            //hold the selected date and month
            int selected_month = Convert.ToInt32(date.Substring(0, 1));
            if (format == "/")
            {
                selected_date = Convert.ToInt32(date.Substring(2, 1));
            }
            else
            {
                selected_date = Convert.ToInt32(date.Substring(2, 2));
            }
            //check whether the selected date is beyond the current date
            if (selected_date <= today && this_month <= selected_month)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        catch
        {
            //promt error meesage is any exception happens
            CustomException ex = new CustomException("Error !!!", "Selected Date is in incorrect format");
            MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
            messageBox.Show(this);

            return true;

        }
    }
开发者ID:neonmax,项目名称:sims,代码行数:42,代码来源:School_Event_UD.aspx.cs

示例11: btnSubmit_Click

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        lblError.ForeColor = Color.Red;
        lblError.Text = "";

        if (txtAdNo.Text == null || txtAdNo.Text.ToString().Length <= 0)
        {

            lblError.Text = "Please fill Admission Number.";
            CustomException ex = new CustomException("Success !!!", "Record Inserted Successfully.");
            MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
            messageBox.Show(this);

        }
        else if (ddlExamination.SelectedIndex <= 0 || ddlYear.SelectedIndex <= 0)
        {
            lblError.Text = "Please select an Examination and Year.";
        }
        else if (txtSubCode.Text == null || txtSubCode.Text.ToString().Length <= 0)
        {
            lblError.Text = "Please fill Subject Code.";
        }
        else if (MedDateCal.SelectedDate == null || MedDateCal.SelectedDate.ToString().Length <= 0)
        {
            lblError.Text = "Please select the Medical Date.";
        }
        else if (ddlDuration.SelectedIndex <= 0)
        {
            lblError.Text = "Please select the Medical Duration.";
        }
        else
        {
            lblError.Text = "";
            addMedical();
        }
    }
开发者ID:neonmax,项目名称:sims,代码行数:36,代码来源:AddMedical.aspx.cs

示例12: gv_events_RowDataBound

    protected void gv_events_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        try
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //check if is in edit mode
                if ((e.Row.RowState & DataControlRowState.Edit) > 0)
                {
                    DropDownList main =
                              (DropDownList)e.Row.FindControl("ddl_master");
                    //Bind subcategories data to dropdownlist
                    main.DataMember = "EVENT_TYPE_MAST";
                    main.DataValueField = "EVENT_TYPE_MAST";
                    main.DataSource = sedb.get_event_master();
                    main.DataBind();
                    DataRowView dr = e.Row.DataItem as DataRowView;
                    main.SelectedValue =
                                 dr["EVENT_TYPE_MAST"].ToString();

                    DropDownList sub =
                    (DropDownList)e.Row.FindControl("ddl_sub");
                    //Bind subcategories data to dropdownlist
                    sub.DataTextField = "EVENT_TYPE_SUB";
                    sub.DataValueField = "EVENT_TYPE_SUB";
                    sub.DataSource = sedb.get_subevents();
                    sub.DataBind();
                    DataRowView dr2 = e.Row.DataItem as DataRowView;
                    main.SelectedValue =
                                 dr["EVENT_TYPE_SUB"].ToString();

                }
            }
        }
        catch
        {
            //promt error meesage is any exception happens
            CustomException ex = new CustomException("Error !!!", "Selected row's values are not available");
            MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
            messageBox.Show(this);
        }
    }
开发者ID:neonmax,项目名称:sims,代码行数:42,代码来源:School_Event_UD.aspx.cs

示例13: gv_events_RowEditing

 protected void gv_events_RowEditing(object sender, GridViewEditEventArgs e)
 {
     try
     {
         //move the selected record in to modify mode
         gv_events.EditIndex = e.NewEditIndex;
         //invoke the fill method
         fill();
     }
     catch
     {
         //promt error meesage is any exception happens
         CustomException ex = new CustomException("Error !!!", "Selected Record can not be move to modify");
         MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
         messageBox.Show(this);
     }
 }
开发者ID:neonmax,项目名称:sims,代码行数:17,代码来源:School_Event_UD.aspx.cs

示例14: gv_UD_hostel_RowDeleting

 /// <summary>
 /// invoke the delete quary. inpu will be the student id
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void gv_UD_hostel_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     txt_search.Text = string.Empty;
     lbl_status.Text = string.Empty;
     GridViewRow row = gv_UD_hostel.Rows[Convert.ToInt32(e.RowIndex)];
     string id = gv_UD_hostel.DataKeys[e.RowIndex].Value.ToString();
     try
     {
         //invoke delete quary, if deletion is succcess prompts a message
         if (hd.delete_hostel(id))
         {
             //lbl_status.Text = "Record Successfully deleted";
             CustomException ex = new CustomException("Success", "Record Successfully Deleted");
             MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
             messageBox.Show(this);
             gv_UD_hostel.EditIndex = -1;
             fill();
             //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('record deleted')", true);
         }
     }
     catch
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Error!!  Selected Record Can not be Deleted.')", true);
     }
     gv_UD_hostel.EditIndex = -1;
     fill();
 }
开发者ID:neonmax,项目名称:sims,代码行数:32,代码来源:Hostel_Reg_UD.aspx.cs

示例15: gv_UD_hostel_RowUpdating

    /// <summary>
    /// when update link clicked the record will be updated. first it read the values from the 
    /// edited grid view.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gv_UD_hostel_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            //create data table to hold the list values after validation
            DataTable dt = new DataTable();
            //add  cloumn
            dt.Columns.Add("values");
            //clear all the fields
            lbl_status.Text = string.Empty;
            txt_search.Text = string.Empty;
            //identfy the selected record
            GridViewRow row = gv_UD_hostel.Rows[Convert.ToInt32(e.RowIndex)];
            //select the student id
            string id = gv_UD_hostel.DataKeys[e.RowIndex].Value.ToString();
            //select the students regsiterd date
            string nfrom = gv_UD_hostel.Rows[Convert.ToInt32(e.RowIndex)].Cells[2].Text;
            //select the to date
            TextBox todate = (TextBox)row.FindControl("txtto");
            string ntodate = todate.Text;
            //select the prefect date
            TextBox prefect = (TextBox)row.FindControl("txt_prefect");
            string nprefect = prefect.Text;
            //select the deputy head prefect year
            TextBox dhprefect = (TextBox)row.FindControl("txt_dh");
            string ndhprefect = dhprefect.Text;
            //select the head prefect year
            TextBox hprefect = (TextBox)row.FindControl("txt_hp");
            string nhprefect = hprefect.Text;
            //select the registerd year
            int year_sep = nfrom.LastIndexOf('/');
            int from_date = Convert.ToInt16(nfrom.Substring(year_sep + 1, 4));
            //invoke date checking validation methodes
            if ((checkdate(ntodate) == 1) && (verify_years(from_date, nprefect, ndhprefect, nhprefect) == 1))
            {
                //create the generic list to hold values
                List<string> list = new List<string>();
                //add records in to list
                list.Add(ntodate); list.Add(nprefect); list.Add(ndhprefect); list.Add(nhprefect);
                //access the each list value and check whether they are null or not
                //if null then set the value as 0;
                foreach (string s in list)
                {
                    if (s == string.Empty || s == null)
                    {
                        dt.Rows.Add("0");
                    }
                    else
                    {
                        dt.Rows.Add(s);
                    }
                }
                //invoke the methide to update methode
                if (hd.update_hostel(id, dt.Rows[0]["values"].ToString(), Convert.ToDecimal(dt.Rows[1]["values"].ToString()), Convert.ToDecimal(dt.Rows[2]["values"].ToString()), Convert.ToDecimal(dt.Rows[3]["values"].ToString())))
                {
                    //display the  suucess message if the operation is succussfull
                    CustomException ex = new CustomException("Success", "Record Successfully Updated");
                    MessageBox messageBox = new MessageBox(ex, MessageBoxDefaultButtonEnum.OK);
                    messageBox.Show(this);
                    gv_UD_hostel.EditIndex = -1;
                    fill();

                    //lbl_status.Text = "record updated successfully";
                    // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Record Successfully Updated')", true);
                }
            }
            else
            {
                //create alert if any exception happens
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Error!! Please Insert Proper Values As Inputs Or Keep The Default Value As It Is.')", true);
            }
        }
        catch (Exception ss)
        {
            string s = ss.Message;
            //lbl_status.Text = "Can not update the record";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", "alert('Error!! Record Can not be Updated')", true);
        }
    }
开发者ID:neonmax,项目名称:sims,代码行数:85,代码来源:Hostel_Reg_UD.aspx.cs


注:本文中的MessageBox.Show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。