Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace LCR_ShepherdStaffupdater_1._0
- {
- partial class formErrorWindow
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- public System.ComponentModel.IContainer components = null;
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- ///
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- // ********* HERE IS THE FUNCTION THAT IVE ADDED BELOW. THIS WOULD WORK BUT.... *********
- public static void showError(string errorTitle, string usrMsg, string errorMsg)
- {
- formErrorWindow errorWindow = new formErrorWindow();
- errorMsgItem.Text = errorMsg;
- errorTitleItem.Text = "Error! : " + errorTitle;
- usrMsgItem.Text = usrMsg;
- errorWindow.ShowDialog();
- }
- // ********* HERE IS THE FUNCTION THAT IVE ADDED ABOVE. THIS WOULD WORK BUT.... *********
- // ********* I get an error: "An object reference is required for the non-static field, method, or property." *********
- public void InitializeComponent()
- {
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(formErrorWindow));
- this.usrMsgItem = new System.Windows.Forms.TextBox();
- this.errorTitleItem = new System.Windows.Forms.Label();
- this.errorMsgItem = new System.Windows.Forms.TextBox();
- this.button1 = new System.Windows.Forms.Button();
- this.panel1 = new System.Windows.Forms.Panel();
- this.label2 = new System.Windows.Forms.Label();
- this.panel1.SuspendLayout();
- this.SuspendLayout();
- //
- // usrMsgItem
- //
- this.usrMsgItem.Enabled = false;
- this.usrMsgItem.Location = new System.Drawing.Point(13, 37);
- this.usrMsgItem.Multiline = true;
- this.usrMsgItem.Name = "usrMsgItem";
- this.usrMsgItem.Size = new System.Drawing.Size(334, 81);
- this.usrMsgItem.TabIndex = 0;
- this.usrMsgItem.Text = "Undefined";
- //
- // errorTitleItem
- //
- this.errorTitleItem.AutoSize = true;
- this.errorTitleItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.errorTitleItem.ForeColor = System.Drawing.Color.Red;
- this.errorTitleItem.Location = new System.Drawing.Point(12, 9);
- this.errorTitleItem.Name = "errorTitleItem";
- this.errorTitleItem.Size = new System.Drawing.Size(152, 20);
- this.errorTitleItem.TabIndex = 1;
- this.errorTitleItem.Text = "Error! : Undefined";
- //
- // errorMsgItem
- //
- this.errorMsgItem.Enabled = false;
- this.errorMsgItem.Location = new System.Drawing.Point(0, 21);
- this.errorMsgItem.Multiline = true;
- this.errorMsgItem.Name = "errorMsgItem";
- this.errorMsgItem.Size = new System.Drawing.Size(329, 101);
- this.errorMsgItem.TabIndex = 2;
- this.errorMsgItem.Text = "Undefined";
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(272, 256);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 3;
- this.button1.Text = "Continue";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // panel1
- //
- this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
- this.panel1.Controls.Add(this.label2);
- this.panel1.Controls.Add(this.errorMsgItem);
- this.panel1.Location = new System.Drawing.Point(12, 124);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(335, 126);
- this.panel1.TabIndex = 4;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label2.Location = new System.Drawing.Point(68, 1);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(189, 17);
- this.label2.TabIndex = 3;
- this.label2.Text = "Technical Error Message";
- //
- // formErrorWindow
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
- this.ClientSize = new System.Drawing.Size(359, 290);
- this.Controls.Add(this.panel1);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.errorTitleItem);
- this.Controls.Add(this.usrMsgItem);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "formErrorWindow";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "Error!";
- this.VisibleChanged += new System.EventHandler(this.formErrorWindow_VisibleChanged);
- this.panel1.ResumeLayout(false);
- this.panel1.PerformLayout();
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- #endregion
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.Label label2;
- public System.Windows.Forms.TextBox usrMsgItem;
- public System.Windows.Forms.Label errorTitleItem;
- public System.Windows.Forms.TextBox errorMsgItem;
- }
- }
- pseudo: public void updateTextBox(string new_text)
- MyMessageBox messageBox = new MyMessageBox("My error message");
- messageBox.Show();
- public Form2(Form1 form1)
- {
- InitializeComponent();
- Owner = form1;
- _form1 = form1;
- }
- _form1.theForm1ControlName
- public void SetErrorText(string errorText)
- {
- this.ErrorMessage.Text = errorText; // assuming the TextBox' ID is ErrorMessage.
- }
- formErrorWindow myErrorWindow;
- formErrorWindow myErrorWindow = new formErrorWindow();
- formErrorWindow myErrorWindow = new formErrorWindow();
- myErrorWindow.showError("Title", "User Message Here", "Error Message Here");
- myErrorWindow.ShowDialog();
- public partial class Form1 : Form
- {
- private static TextBox box;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- // box
- box = new TextBox();
- box.Location = new System.Drawing.Point(87, 230);
- box.Name = "box";
- box.Size = new System.Drawing.Size(100, 20);
- box.TabIndex = 1;
- this.Controls.Add(box);
- }
- }
Add Comment
Please, Sign In to add comment