|
I have developed an application ! In my main class, I call 8 Threading to work something. My main class must to wait all 8 Threading end in order to continute do something. I don't known how to suspend my main class to wait all 8 Threading end. How to known all 8 Threading end. Pls, help me !
Thank alots !
|
|
|
|
|
If you have 8 threads and one task per thread which completes when the thread is complete, then you can do something like this:
[edit]
I just re-read the docs and WaitAll won't work for threads. The best you can do is something like what I have below, I'd use delegates and use beginInvoke and endInvoke because you can use WaitHandle.WaitAll plus your threads are running from the thread pool so it will be faster.
[/edit]
bool WaitForThreads(Thread[] threads)
{
foreach(Thread t in threads)
{
if (!t.Join(1))
{
return false;
}
}
return true;
}
Then in your function
while (!WaitForThreads(threads))
Application.DoEvents();
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
-- modified at 23:51 Sunday 11th September, 2005
|
|
|
|
|
Thank you very much !
I have tried the methord you suggest. It done well.
Thank again !
|
|
|
|
|
hi to all,
have MDI form that obviously has children forms in it.
i also have a toolbar that has buttons on it for each new (and existing) for in the MdiChildren[]
when i click on a button to bring a child form to the front i can see other forms flickering in background, is there a way around this?
also which event is fired when the control box, max and min are clicked.
kind regards,
g00fy
|
|
|
|
|
:(Using VS2003 I've created a Windows Form database application to search, update, add and delete records from an SQL Server. Everything works fine until I swap out one of the textboxes for a databound combobox. The combo box is a drop down for "states" and I'm representing them as selected index values (integer) in the database which I bind to when I initialize the page. Search and Update functions work but the ADD (button3) record fails. Any help would be greatly appreciated.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace ImmediateAccessWIP
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.Panel panel1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private ImmediateAccessWIP.dsStaffPhysicians dsStaffPhysicians1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox txtBoxSPSearch;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.ComboBox cBoxSPLicenseState;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Label lblRecordResults;
private System.Windows.Forms.MenuItem menuItem4;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.panel1 = new System.Windows.Forms.Panel();
this.textBox1 = new System.Windows.Forms.TextBox();
this.dsStaffPhysicians1 = new ImmediateAccessWIP.dsStaffPhysicians();
this.cBoxSPLicenseState = new System.Windows.Forms.ComboBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.txtBoxSPSearch = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.lblRecordResults = new System.Windows.Forms.Label();
this.button8 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dsStaffPhysicians1)).BeginInit();
this.groupBox1.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem4});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3});
this.menuItem1.Text = "Mode";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "Staff Physicians";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Text = "Exit";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(0, 544);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(792, 22);
this.statusBar1.TabIndex = 0;
this.statusBar1.Text = "statusBar1";
//
// panel1
//
this.panel1.Controls.Add(this.textBox1);
this.panel1.Controls.Add(this.cBoxSPLicenseState);
this.panel1.Controls.Add(this.textBox7);
this.panel1.Controls.Add(this.textBox6);
this.panel1.Controls.Add(this.textBox4);
this.panel1.Controls.Add(this.textBox3);
this.panel1.Controls.Add(this.textBox2);
this.panel1.Controls.Add(this.groupBox1);
this.panel1.Controls.Add(this.panel2);
this.panel1.Location = new System.Drawing.Point(16, 24);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(760, 448);
this.panel1.TabIndex = 1;
this.panel1.Visible = false;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(32, 136);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 8;
this.textBox1.Text = "";
//
// dsStaffPhysicians1
//
this.dsStaffPhysicians1.DataSetName = "dsStaffPhysicians";
this.dsStaffPhysicians1.Locale = new System.Globalization.CultureInfo("en-US");
//
// cBoxSPLicenseState
//
this.cBoxSPLicenseState.Items.AddRange(new object[] {
"",
"AK",
"AL",
"AR",
"AZ",
"CA",
"CT",
"DC",
"DE",
"FL",
"GA",
"HI",
"IA",
"ID",
"IL",
"IN",
"KS",
"KY",
"LA",
"MA",
"MD",
"ME",
"MI",
"MN",
"MO",
"MS",
"MT",
"NC",
"ND",
"NE",
"NH",
"NJ",
"NM",
"NV",
"NY",
"OH",
"OK",
"OR",
"PA",
"RI",
"SC",
"SD",
"TN",
"TX",
"UT",
"VA",
"VT",
"WA",
"WI",
"WV",
"WY"});
this.cBoxSPLicenseState.Location = new System.Drawing.Point(32, 184);
this.cBoxSPLicenseState.Name = "cBoxSPLicenseState";
this.cBoxSPLicenseState.Size = new System.Drawing.Size(48, 21);
this.cBoxSPLicenseState.TabIndex = 7;
//
// textBox7
//
this.textBox7.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dsStaffPhysicians1, "tblStaffPhysicians.docUpin"));
this.textBox7.Location = new System.Drawing.Point(288, 136);
this.textBox7.Name = "textBox7";
this.textBox7.TabIndex = 6;
this.textBox7.Text = "";
//
// textBox6
//
this.textBox6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dsStaffPhysicians1, "tblStaffPhysicians.docLicenseNumber"));
this.textBox6.Location = new System.Drawing.Point(160, 136);
this.textBox6.Name = "textBox6";
this.textBox6.TabIndex = 5;
this.textBox6.Text = "";
//
// textBox4
//
this.textBox4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dsStaffPhysicians1, "tblStaffPhysicians.docLName"));
this.textBox4.Location = new System.Drawing.Point(288, 96);
this.textBox4.Name = "textBox4";
this.textBox4.TabIndex = 3;
this.textBox4.Text = "";
//
// textBox3
//
this.textBox3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dsStaffPhysicians1, "tblStaffPhysicians.docMName"));
this.textBox3.Location = new System.Drawing.Point(160, 96);
this.textBox3.Name = "textBox3";
this.textBox3.TabIndex = 2;
this.textBox3.Text = "";
//
// textBox2
//
this.textBox2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dsStaffPhysicians1, "tblStaffPhysicians.docFName"));
this.textBox2.Location = new System.Drawing.Point(32, 96);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 1;
this.textBox2.Text = "";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button4);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.txtBoxSPSearch);
this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.groupBox1.Location = new System.Drawing.Point(24, 16);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(544, 48);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Search By Name:";
//
// button4
//
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button4.Location = new System.Drawing.Point(405, 15);
this.button4.Name = "button4";
this.button4.TabIndex = 4;
this.button4.Text = "button4";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button3.Location = new System.Drawing.Point(312, 15);
this.button3.Name = "button3";
this.button3.TabIndex = 3;
this.button3.Text = "button3";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button2.Location = new System.Drawing.Point(219, 15);
this.button2.Name = "button2";
this.button2.TabIndex = 2;
this.button2.Text = "button2";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button1.Location = new System.Drawing.Point(126, 15);
this.button1.Name = "button1";
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// txtBoxSPSearch
//
this.txtBoxSPSearch.Location = new System.Drawing.Point(8, 16);
this.txtBoxSPSearch.Name = "txtBoxSPSearch";
this.txtBoxSPSearch.TabIndex = 0;
this.txtBoxSPSearch.Text = "";
//
// panel2
//
this.panel2.Controls.Add(this.lblRecordResults);
this.panel2.Controls.Add(this.button8);
this.panel2.Controls.Add(this.button7);
this.panel2.Controls.Add(this.button6);
this.panel2.Controls.Add(this.button5);
this.panel2.Location = new System.Drawing.Point(144, 352);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(520, 56);
this.panel2.TabIndex = 2;
//
// lblRecordResults
//
this.lblRecordResults.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.lblRecordResults.Location = new System.Drawing.Point(208, 19);
this.lblRecordResults.Name = "lblRecordResults";
this.lblRecordResults.Size = new System.Drawing.Size(100, 16);
this.lblRecordResults.TabIndex = 4;
this.lblRecordResults.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button8
//
this.button8.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button8.Location = new System.Drawing.Point(416, 16);
this.button8.Name = "button8";
this.button8.TabIndex = 3;
this.button8.Text = "Last";
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button7
//
this.button7.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button7.Location = new System.Drawing.Point(328, 16);
this.button7.Name = "button7";
this.button7.TabIndex = 2;
this.button7.Text = "Next";
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button6
//
this.button6.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button6.Location = new System.Drawing.Point(120, 16);
this.button6.Name = "button6";
this.button6.TabIndex = 1;
this.button6.Text = "Previous";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button5
//
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.button5.Location = new System.Drawing.Point(32, 16);
this.button5.Name = "button5";
this.button5.TabIndex = 0;
this.button5.Text = "First";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "tblStaffPhysicians", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("docIndex", "docIndex"),
new System.Data.Common.DataColumnMapping("docLName", "docLName"),
new System.Data.Common.DataColumnMapping("docFName", "docFName"),
new System.Data.Common.DataColumnMapping("docMName", "docMName"),
new System.Data.Common.DataColumnMapping("docLicenseState", "docLicenseState"),
new System.Data.Common.DataColumnMapping("docLicenseNumber", "docLicenseNumber"),
new System.Data.Common.DataColumnMapping("docUpin", "docUpin"),
new System.Data.Common.DataColumnMapping("docAddress1", "docAddress1"),
new System.Data.Common.DataColumnMapping("docAddress2", "docAddress2"),
new System.Data.Common.DataColumnMapping("docCity", "docCity"),
new System.Data.Common.DataColumnMapping("docState", "docState"),
new System.Data.Common.DataColumnMapping("docZip", "docZip"),
new System.Data.Common.DataColumnMapping("docSpecialty", "docSpecialty"),
new System.Data.Common.DataColumnMapping("docPhone1", "docPhone1"),
new System.Data.Common.DataColumnMapping("docPhoneType1", "docPhoneType1"),
new System.Data.Common.DataColumnMapping("docPhone2", "docPhone2"),
new System.Data.Common.DataColumnMapping("docPhoneType2", "docPhoneType2"),
new System.Data.Common.DataColumnMapping("docPhone3", "docPhone3"),
new System.Data.Common.DataColumnMapping("docPhoneType3", "docPhoneType3"),
new System.Data.Common.DataColumnMapping("docPhone4", "docPhone4"),
new System.Data.Common.DataColumnMapping("docPhoneType4", "docPhoneType4"),
new System.Data.Common.DataColumnMapping("docEmail", "docEmail"),
new System.Data.Common.DataColumnMapping("recCreatedBy", "recCreatedBy"),
new System.Data.Common.DataColumnMapping("recModifiedBy", "recModifiedBy"),
new System.Data.Common.DataColumnMapping("recCreated", "recCreated"),
new System.Data.Common.DataColumnMapping("recModified", "recModified")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = "[SP_StaffPhysicianDeleteCommand]";
this.sqlDeleteCommand1.CommandType = System.Data.CommandType.StoredProcedure;
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docIndex", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docIndex", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docAddress1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docAddress1", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docAddress2", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docAddress2", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docCity", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docCity", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docEmail", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docEmail", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docFName", System.Data.SqlDbType.VarChar, 35, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docFName", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docLName", System.Data.SqlDbType.VarChar, 35, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docLName", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docLicenseNumber", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docLicenseNumber", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docLicenseState", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docLicenseState", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docMName", System.Data.SqlDbType.VarChar, 35, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docMName", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhone1", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhone1", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhone2", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhone2", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhone3", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhone3", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhone4", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhone4", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhoneType1", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhoneType1", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhoneType2", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhoneType2", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhoneType3", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhoneType3", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhoneType4", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhoneType4", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docSpecialty", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docSpecialty", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docState", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docState", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docUpin", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docUpin", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docZip", System.Data.SqlDbType.VarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docZip", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_recCreated", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "recCreated", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_recCreatedBy", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "recCreatedBy", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_recModified", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "recModified", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_recModifiedBy", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "recModifiedBy", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=COLOSSUS;packet size=4096;user id=ia;data source=QUEEN01;persist s" +
"ecurity info=True;initial catalog=ImmediateAccessWIP;password=pass4u";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "[SP_StaffPhysicianInsertCommand]";
this.sqlInsertCommand1.CommandType = System.Data.CommandType.StoredProcedure;
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docLName", System.Data.SqlDbType.VarChar, 35, "docLName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docFName", System.Data.SqlDbType.VarChar, 35, "docFName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docMName", System.Data.SqlDbType.VarChar, 35, "docMName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docLicenseState", System.Data.SqlDbType.TinyInt, 1, "docLicenseState"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docLicenseNumber", System.Data.SqlDbType.VarChar, 20, "docLicenseNumber"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docUpin", System.Data.SqlDbType.VarChar, 20, "docUpin"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docAddress1", System.Data.SqlDbType.VarChar, 50, "docAddress1"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docAddress2", System.Data.SqlDbType.VarChar, 50, "docAddress2"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docCity", System.Data.SqlDbType.VarChar, 50, "docCity"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docState", System.Data.SqlDbType.TinyInt, 1, "docState"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docZip", System.Data.SqlDbType.VarChar, 5, "docZip"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docSpecialty", System.Data.SqlDbType.VarChar, 50, "docSpecialty"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhone1", System.Data.SqlDbType.VarChar, 20, "docPhone1"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhoneType1", System.Data.SqlDbType.TinyInt, 1, "docPhoneType1"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhone2", System.Data.SqlDbType.VarChar, 20, "docPhone2"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhoneType2", System.Data.SqlDbType.TinyInt, 1, "docPhoneType2"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhone3", System.Data.SqlDbType.VarChar, 20, "docPhone3"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhoneType3", System.Data.SqlDbType.TinyInt, 1, "docPhoneType3"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhone4", System.Data.SqlDbType.VarChar, 20, "docPhone4"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhoneType4", System.Data.SqlDbType.TinyInt, 1, "docPhoneType4"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docEmail", System.Data.SqlDbType.VarChar, 50, "docEmail"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@recCreatedBy", System.Data.SqlDbType.VarChar, 20, "recCreatedBy"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@recModifiedBy", System.Data.SqlDbType.VarChar, 20, "recModifiedBy"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@recCreated", System.Data.SqlDbType.DateTime, 8, "recCreated"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@recModified", System.Data.SqlDbType.DateTime, 8, "recModified"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "[SP_StaffPhysicianSelectCommand]";
this.sqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure;
this.sqlSelectCommand1.Connection = this.sqlConnection1;
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param2", System.Data.SqlDbType.VarChar, 35, "docLName"));
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = "[SP_StaffPhysicianUpdateCommand]";
this.sqlUpdateCommand1.CommandType = System.Data.CommandType.StoredProcedure;
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docLName", System.Data.SqlDbType.VarChar, 35, "docLName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docFName", System.Data.SqlDbType.VarChar, 35, "docFName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docMName", System.Data.SqlDbType.VarChar, 35, "docMName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docLicenseState", System.Data.SqlDbType.TinyInt, 1, "docLicenseState"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docLicenseNumber", System.Data.SqlDbType.VarChar, 20, "docLicenseNumber"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docUpin", System.Data.SqlDbType.VarChar, 20, "docUpin"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docAddress1", System.Data.SqlDbType.VarChar, 50, "docAddress1"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docAddress2", System.Data.SqlDbType.VarChar, 50, "docAddress2"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docCity", System.Data.SqlDbType.VarChar, 50, "docCity"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docState", System.Data.SqlDbType.TinyInt, 1, "docState"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docZip", System.Data.SqlDbType.VarChar, 5, "docZip"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docSpecialty", System.Data.SqlDbType.VarChar, 50, "docSpecialty"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhone1", System.Data.SqlDbType.VarChar, 20, "docPhone1"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhoneType1", System.Data.SqlDbType.TinyInt, 1, "docPhoneType1"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhone2", System.Data.SqlDbType.VarChar, 20, "docPhone2"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhoneType2", System.Data.SqlDbType.TinyInt, 1, "docPhoneType2"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhone3", System.Data.SqlDbType.VarChar, 20, "docPhone3"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhoneType3", System.Data.SqlDbType.TinyInt, 1, "docPhoneType3"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhone4", System.Data.SqlDbType.VarChar, 20, "docPhone4"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docPhoneType4", System.Data.SqlDbType.TinyInt, 1, "docPhoneType4"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docEmail", System.Data.SqlDbType.VarChar, 50, "docEmail"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@recCreatedBy", System.Data.SqlDbType.VarChar, 20, "recCreatedBy"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@recModifiedBy", System.Data.SqlDbType.VarChar, 20, "recModifiedBy"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@recCreated", System.Data.SqlDbType.DateTime, 8, "recCreated"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@recModified", System.Data.SqlDbType.DateTime, 8, "recModified"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docIndex", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docIndex", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docAddress1", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docAddress1", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docAddress2", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docAddress2", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docCity", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docCity", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docEmail", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docEmail", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docFName", System.Data.SqlDbType.VarChar, 35, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docFName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docLName", System.Data.SqlDbType.VarChar, 35, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docLName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docLicenseNumber", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docLicenseNumber", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docLicenseState", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docLicenseState", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docMName", System.Data.SqlDbType.VarChar, 35, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docMName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhone1", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhone1", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhone2", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhone2", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhone3", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhone3", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhone4", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhone4", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhoneType1", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhoneType1", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhoneType2", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhoneType2", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhoneType3", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhoneType3", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docPhoneType4", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docPhoneType4", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docSpecialty", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docSpecialty", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docState", System.Data.SqlDbType.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docState", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docUpin", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docUpin", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_docZip", System.Data.SqlDbType.VarChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "docZip", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_recCreated", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "recCreated", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_recCreatedBy", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "recCreatedBy", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_recModified", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "recModified", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_recModifiedBy", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "recModifiedBy", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@docIndex", System.Data.SqlDbType.Int, 4, "docIndex"));
//
// menuItem4
//
this.menuItem4.Index = 1;
this.menuItem4.Text = "Help";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(792, 566);
this.Controls.Add(this.panel1);
this.Controls.Add(this.statusBar1);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "Immediate Access v1.01";
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dsStaffPhysicians1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
//Load Staff Physician Screen
SetupStaffPhysician();
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
//Exit Application
Application.Exit();
}
private void SetupStaffPhysician()
{
panel1.Visible = true;
button4.Enabled =false;
button1.Text = "Search";
button2.Text = "Clear";
button3.Text= "Add";
button4.Text = "Delete";
statusBar1.Text = "Ready";
this.lblRecordResults.Text = "";
DisableNavigation();
ClearStaffPhysicians();
DisableStaffPhysicians();
this.cBoxSPLicenseState.DataBindings.Add(new System.Windows.Forms.Binding("SelectedIndex", this.dsStaffPhysicians1, "tblStaffPhysicians.docLicenseState"));
}
private void button1_Click(object sender, System.EventArgs e)
{
if(this.button1.Text.Equals("Search"))
{
sqlDataAdapter1.SelectCommand.Parameters["@Param2"].Value = txtBoxSPSearch.Text;
dsStaffPhysicians1.Clear();
sqlDataAdapter1.Fill(dsStaffPhysicians1);
SPRecordPosition();
this.txtBoxSPSearch.Enabled = false;
this.statusBar1.Text = "Search Completed";
}
else if(this.button1.Text.Equals("Update"))
{
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].EndCurrentEdit();
sqlDataAdapter1.Update(dsStaffPhysicians1);
this.button1.Enabled = false;
this.statusBar1.Text = "Update Completed";
}
}
private void button2_Click(object sender, System.EventArgs e)
{
if(this.button2.Text.Equals("Clear"))
{
dsStaffPhysicians1.Clear();
SPRecordPosition();
this.button1.Enabled = true;
this.txtBoxSPSearch.Enabled = true;
this.txtBoxSPSearch.Text = "";
this.button1.Text = "Search";
this.statusBar1.Text = "Ready";
}
else
{
//TODO
}
}
private void button3_Click(object sender, System.EventArgs e)
{
if(this.button3.Text.Equals("Add"))
{
//Prepare For Insert
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].AddNew();
this.button3.Text = "Apply";
EnableStaffPhysicians();
DisableNavigation();
ClearStaffPhysicians();
button1.Enabled = false;
button2.Enabled = false;
button4.Enabled = true;
this.txtBoxSPSearch.Enabled = false;
this.txtBoxSPSearch.Text = "";
button4.Text = "Cancel";
this.statusBar1.Text = "Begin Edit";
}
else if(this.button3.Text.Equals("Apply"))
{ //Finish Insert
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].EndCurrentEdit();
sqlDataAdapter1.Update(dsStaffPhysicians1);
button1.Enabled = true;
button2.Enabled = true;
button1.Text = "Update";
button3.Text = "Add";
button4.Text = "Delete";
SPRecordPosition();
this.statusBar1.Text = "Record Inserted";
}
else if(this.button3.Text.Equals("Cancel"))
{
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].CancelCurrentEdit();
button1.Enabled = true;
button2.Enabled = true;
EnableNavigation();
button3.Text = "Add";
button4.Text = "Delete";
}
}
private void button4_Click(object sender, System.EventArgs e)
{
if(this.button4.Text.Equals("Cancel"))
{
button3.Text = "Add";
button4.Text = "Delete";
button2.Enabled = true;
button1.Enabled = true;
this.txtBoxSPSearch.Enabled = true;
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].CancelCurrentEdit();
SPRecordPosition();
}
else if(this.button4.Text.Equals("Delete"))
{
button1.Enabled = false;
button2.Enabled = false;
button3.Text = "Cancel";
button4.Text = "Apply";
DisableNavigation();
statusBar1.Text = "Confirm Delete";
}
else if(this.button4.Text.Equals("Apply"))
{
this.dsStaffPhysicians1.tblStaffPhysicians.Rows[this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].Position].Delete();
sqlDataAdapter1.Update(dsStaffPhysicians1);
sqlDataAdapter1.Fill(dsStaffPhysicians1);
button4.Text = "Delete";
button1.Enabled = true;
button2.Enabled = true;
button3.Text = "Add";
EnableNavigation();
}
}
private void button5_Click(object sender, System.EventArgs e)
{
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].Position = 0;
this.dsStaffPhysicians1.RejectChanges();
SPRecordPosition();
}
private void button6_Click(object sender, System.EventArgs e)
{
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].Position -= 1;
this.dsStaffPhysicians1.RejectChanges();
SPRecordPosition();
}
private void button7_Click(object sender, System.EventArgs e)
{
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].Position += 1;
this.dsStaffPhysicians1.RejectChanges();
SPRecordPosition();
}
private void button8_Click(object sender, System.EventArgs e)
{
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].Position = this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].Count -1;
this.dsStaffPhysicians1.RejectChanges();
SPRecordPosition();
}
private void SPRecordPosition()
{
try //Record position and navigation buttons
{
int iCnt;
int iPos;
iCnt = this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].Count;
iPos = this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].Position + 1;
if(iCnt == 0)
{
lblRecordResults.Text = "No Records";
DisableStaffPhysicians();
DisableNavigation();
this.button1.Text = "Search";
button4.Enabled = false;
}
else
{
lblRecordResults.Text = iPos.ToString() + " of " + iCnt.ToString();
EnableStaffPhysicians();
EnableNavigation();
button1.Enabled = true;
button4.Enabled = true;
button1.Text = "Update";
button2.Text = "Clear";
}
if(iCnt <= 1)
{
button5.Enabled = false;
button6.Enabled = false;
button7.Enabled = false;
button8.Enabled = false;
}
else
{
if(iPos >= 2)
{
button5.Enabled = true;
button6.Enabled = true;
}
else
{
button5.Enabled = false;
button6.Enabled = false;
}
if(iPos == iCnt)
{
button7.Enabled = false;
button8.Enabled = false;
}
else
{
button7.Enabled = true;
button8.Enabled = true;
}
}
}
catch(Exception exp)
{
MessageBox.Show("Error 003 " + exp.Message);
}
}
private void EnableNavigation()
{
button5.Enabled = true;
button6.Enabled = true;
button7.Enabled = true;
button8.Enabled = true;
}
private void DisableNavigation()
{
button5.Enabled = false;
button6.Enabled = false;
button7.Enabled = false;
button8.Enabled = false;
}
private void ClearStaffPhysicians()
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox7.Text = "";
textBox6.Text = "";
cBoxSPLicenseState.SelectedIndex = 0;
}
private void EnableStaffPhysicians()
{
textBox1.Enabled = true;
textBox2.Enabled = true;
textBox3.Enabled = true;
textBox4.Enabled = true;
textBox7.Enabled = true;
textBox6.Enabled = true;
}
private void DisableStaffPhysicians()
{
textBox1.Enabled = false;
textBox2.Enabled = false;
textBox3.Enabled = false;
textBox4.Enabled = false;
textBox7.Enabled = false;
textBox6.Enabled = false;
}
}
}
|
|
|
|
|
I'm not gonna trawl through all this code, but in the first instance, you should name your variables something more intelligent than textBox1, textBox2, etc.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
This is a development version to get past a hump point, it contains only the controls necessary to bind to the dataset and enforce the required business rule constraints. The problem is databinding the selected index of a combobox. If you can't help please stay out of the loop.
|
|
|
|
|
rich_wenger wrote:
If you can't help please stay out of the loop.
I can help, but first I need to know what is going wrong, and I'm sure not going to read 1000 lines to try and work that out. So you find it easier to work on proof of concept when none of your code is readable ? Brilliant.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Sorry, the error I get is 'An unhandled exception of type 'System.Data.NoNullAllowedException' occurred in system.data.dll'; but this error only occurrs if I attempt to insert a record without first performing a search. Otherwise the insert fires successfully but over-writes an existing record (doesn't create a new one).
|
|
|
|
|
This code is unreadable. It also is useless, you've pasted your entire file in here, which tells me you've done nothing to work out exactly where the error is. Do you know how to use the debugger ?
I tried to create this project myself to see if it would run ( although I didn't expect it to ), but private ImmediateAccessWIP.dsStaffPhysicians dsStaffPhysicians1; means that no-one can try to run your code to see what's going on. So why post all this boiler plate stuff here ?
Debug your code, figure out exactly what is happening, what is being called, and where things go wrong. Then, post the offending code and more people will try to help, because it will look like you did something first, and we'll have some idea where we are looking for a problem.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm sorry. I've assumed that you were familiar with VS2003 you would know everything above the Main() method was IDE generated (therefore it's most likely the problem exits below). I have attempted to debug the code; if you know how to databind a combobox on the selected index that would be of help. Otherwise please end the thread.
|
|
|
|
|
rich_wenger wrote:
I've assumed that you were familiar with VS2003 you would know everything above the Main() method was IDE generated
But you assumed I'd like to download that code every time I read this page ? And that it's my job to trawl through this IDE generated code to find your stuff ?
rich_wenger wrote:
I have attempted to debug the code
So - what happened ?
rich_wenger wrote:
if you know how to databind a combobox on the selected index that would be of help
How do you mean ? You want to databind one control based on the selected index of another ?
rich_wenger wrote:
Otherwise please end the thread.
This is a community site. I'm a developer who uses this site and is trying to help you, I am not staff on this site. No-one ends threads here, the site doesn't even support thread locking AFAIK.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
But you're not trying to help; you're trying to lecture. I'm looking for help. If you PC is slow copy the code to notepad, maybe that will help. I didn't assume anything about your job; I'm new to C-Sharp and asking for help databinding a control to a dataset. Do you have any exptertise in that area or not?
|
|
|
|
|
rich_wenger wrote:
But you're not trying to help; you're trying to lecture. I'm looking for help.
You want me to help, without pointing out the things you're doing wrong ? I'm trying both to give you advice as to why no-one has helped you ( your post showed all the signs of you giving the problem no thought yourself, it contains a lot of code that cannot be the problem, you don't bother to say where the problem is, or even exactly what it is ), and to work out what's going on so I can offer help.
rich_wenger wrote:
If you PC is slow copy the code to notepad, maybe that will help.
I have a fast computer, but my network connection is slow. I copied the code to VS, as it happens, but it isn't enough to compile and run ( which would be the only reason for posting so much code ). The point is that some people read this site on 28.8, they are being forced to download all this pointless code every time they open this page, and people who read your post will almost all immediately disregard it because it is so long and obviously unfocused.
rich_wenger wrote:
I'm new to C-Sharp and asking for help databinding a control to a dataset.
Well, it depends on the type of control, a combobox or listview needs to be told what columns to databind to, and you need to also select a table or view from the dataset to bind against.
rich_wenger wrote:
Do you have any exptertise in that area or not?
If I didn't, I wouldn't have bothered answering at all.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
I don't what ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
private void button1_Click(object sender, System.EventArgs e)
{
/*bool*/ bValueState = false;
Invalidate();
}
|
|
|
|
|
Can you explain more
MCAD
|
|
|
|
|
To reuse the one handler for multiple buttons, use the sender property to work out which button invoked the method.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Why isn't this working?
TemplateColumn tcTextBox = new TemplateColumn();<br />
tcTextBox.ItemTemplate = new DataGridTemplate(ListItemType.Header, "Change");<br />
tcTextBox.ItemTemplate = new DataGridTemplate(ListItemType.Item, "Change");<br />
tcTextBox.EditItemTemplate = new DataGridTemplate(ListItemType.EditItem, "Change");<br />
tcTextBox.ItemTemplate = new DataGridTemplate(ListItemType.Footer, "Change");<br />
DataColumn dcTextBox = new DataColumn(tcTextBox.ToString());<br />
dtshowskills.Columns.Add(dcTextBox);<br />
<br />
public void InstantiateIn(System.Web.UI.Control container)<br />
{<br />
Literal lc = new Literal();<br />
switch(templateType)<br />
{<br />
case ListItemType.Header:<br />
lc.Text = "" + columnName + "";<br />
container.Controls.Add(lc);<br />
break;<br />
case ListItemType.Item:<br />
lc.Text = "Item " + columnName;<br />
container.Controls.Add(lc);<br />
break;<br />
case ListItemType.EditItem:<br />
TextBox tb = new TextBox();<br />
tb.Text = "";<br />
container.Controls.Add(tb);<br />
break;<br />
case ListItemType.Footer:<br />
lc.Text = "" + columnName + "";<br />
container.Controls.Add(lc);<br />
break;<br />
}<br />
}<br />
}
Thanks in advance!
|
|
|
|
|
You forgot to mention your problem again. In the mean time, you might want to take a look at articles like this one:
http://www.codeproject.com/aspnet/datagriddemo.asp[^]
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Now my problem is different. Now I can't get the datatable to add my template column, it won't actually add the textbox into it. And also, how do I get the program to call InitializeComponent first? This is my updated code.
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
// Make the Datagrid
CreateTable();
}
public void CreateTable ()
{
//Make the 'askills' array dynamically set
///Sets all of the Skills to the array 'askills'
askills[0] = "Attack";
askills[1] = "Strength";
askills[2] = "Defense";
askills[3] = "Ranged";
askills[4] = "Prayer";
askills[5] = "Magic";
askills[6] = "Runecrafting";
askills[7] = "Hitpoints";
askills[8] = "Agility";
askills[9] = "Herblore";
askills[10] = "Thieving";
askills[11] = "Crafting";
askills[12] = "Fleching";
askills[13] = "Slayer";
askills[14] = "Mining";
askills[15] = "Smelting";
askills[16] = "Fishing";
askills[17] = "Cooking";
askills[18] = "Firemaking";
askills[19] = "Woodcutting";
askills[20] = "Farming";
///Our connection string to the DB and open it
string szConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\inetpub\\kenkemkalrisell\\runescape\\databases\\runescapestats.mdb";
cn = new OleDbConnection(szConn);
///Open the database
OpenDB(cn);
StringBuilder szMyQuery = new StringBuilder ();
szMyQuery.AppendFormat ("SELECT User.Username, realStats.Attack, realStats.Strength, realStats.Defense, realStats.Ranged, realStats.Prayer, realStats.Magic, realStats.Runecrafting, realStats.Hitpoints, realStats.Agility, realStats.Herblore, realStats.Thieving, realStats.Crafting, realStats.Fleching, realStats.Slayer, realStats.Mining, realStats.Smelting, realStats.Fishing, realStats.Cooking, realStats.Firemaking, realStats.Woodcutting, realStats.Farming FROM [User] INNER JOIN realStats ON User.ID = realStats.ID WHERE (((User.Username)='{0}'))", szUsername);
OleDbCommand cmd = new OleDbCommand(szMyQuery.ToString (), cn);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
int iAttackOrdinal = rdr.GetOrdinal("Attack");
int intAttack = rdr.GetInt32(iAttackOrdinal);
int iStrengthOrdinal = rdr.GetOrdinal("Strength");
int intStrength = rdr.GetInt32(iStrengthOrdinal);
int iDefenseOrdinal = rdr.GetOrdinal("Defense");
int intDefense = rdr.GetInt32(iDefenseOrdinal);
int iRangedOrdinal = rdr.GetOrdinal("Ranged");
int intRanged = rdr.GetInt32(iRangedOrdinal);
int iPrayerOrdinal = rdr.GetOrdinal("Prayer");
int intPrayer = rdr.GetInt32(iPrayerOrdinal);
int iMagicOrdinal = rdr.GetOrdinal("Magic");
int intMagic = rdr.GetInt32(iMagicOrdinal);
int iRunecraftingOrdinal = rdr.GetOrdinal("Runecrafting");
int intRunecrafting = rdr.GetInt32(iRunecraftingOrdinal);
int iHitpointsOrdinal = rdr.GetOrdinal("Hitpoints");
int intHitpoints = rdr.GetInt32(iHitpointsOrdinal);
int iAgilityOrdinal = rdr.GetOrdinal("Agility");
int intAgility = rdr.GetInt32(iAgilityOrdinal);
int iHerbloreOrdinal = rdr.GetOrdinal("Herblore");
int intHerblore = rdr.GetInt32(iHerbloreOrdinal);
int iThievingOrdinal = rdr.GetOrdinal("Thieving");
int intThieving = rdr.GetInt32(iThievingOrdinal);
int iCraftingOrdinal = rdr.GetOrdinal("Crafting");
int intCrafting = rdr.GetInt32(iCraftingOrdinal);
int iFlechingOrdinal = rdr.GetOrdinal("Fleching");
int intFleching = rdr.GetInt32(iFlechingOrdinal);
int iSlayerOrdinal = rdr.GetOrdinal("Slayer");
int intSlayer = rdr.GetInt32(iSlayerOrdinal);
int iMiningOrdinal = rdr.GetOrdinal("Mining");
int intMining = rdr.GetInt32(iMiningOrdinal);
int iSmeltingOrdinal = rdr.GetOrdinal("Smelting");
int intSmelting = rdr.GetInt32(iSmeltingOrdinal);
int iFishingOrdinal = rdr.GetOrdinal("Fishing");
int intFishing = rdr.GetInt32(iFishingOrdinal);
int iCookingOrdinal = rdr.GetOrdinal("Cooking");
int intCooking = rdr.GetInt32(iCookingOrdinal);
int iFiremakingOrdinal = rdr.GetOrdinal("Firemaking");
int intFiremaking = rdr.GetInt32(iFiremakingOrdinal);
int iWoodcuttingOrdinal = rdr.GetOrdinal("Woodcutting");
int intWoodcutting = rdr.GetInt32(iWoodcuttingOrdinal);
int iFarmingOrdinal = rdr.GetOrdinal("Farming");
int intFarming = rdr.GetInt32(iFarmingOrdinal);
alevel[0] = intAttack;
alevel[1] = intStrength;
alevel[2] = intDefense;
alevel[3] = intRanged;
alevel[4] = intPrayer;
alevel[5] = intMagic;
alevel[6] = intRunecrafting;
alevel[7] = intHitpoints;
alevel[8] = intAgility;
alevel[9] = intHerblore;
alevel[10] = intThieving;
alevel[11] = intCrafting;
alevel[12] = intFleching;
alevel[13] = intSlayer;
alevel[14] = intMining;
alevel[15] = intSmelting;
alevel[16] = intFishing;
alevel[17] = intCooking;
alevel[18] = intFiremaking;
alevel[19] = intWoodcutting;
alevel[20] = intFarming;
}
rdr.Close();
CloseDB(cn);
///The creation of the table that shows the user their stats from the database
///Dynamic Creation of the datatable
///Also sets up the new datatable
DataTable dtshowskills = new DataTable("USkills");
DataColumn dcuserSkill = new DataColumn("Skill");
dcuserSkill.DataType = System.Type.GetType("System.String");
dtshowskills.Columns.Add(dcuserSkill);
DataColumn dcuserLevel = new DataColumn("Level");
dcuserLevel.DataType = System.Type.GetType("System.Int32");
dtshowskills.Columns.Add(dcuserLevel);
DataColumn dcgoalLevel = new DataColumn("Goal");
dcgoalLevel.DataType = System.Type.GetType("System.Int32");
dtshowskills.Columns.Add(dcgoalLevel);
int i = 0;
while (i <= 20)
{
DataRow drskill = dtshowskills.NewRow();
drskill["Skill"] = askills[i];
drskill["Level"] = alevel[i];
drskill["Goal"] = agoal[i];
dtshowskills.Rows.Add(drskill);
i++;
}
TemplateColumn tcTextBoxes = new TemplateColumn();
tcTextBoxes.HeaderTemplate = new DataGridTemplate(ListItemType.Header, "Change Goals");
//tcTextBoxes.ItemTemplate = new DataGridTemplate(ListItemType.Item, "Change Goals");
tcTextBoxes.EditItemTemplate = new DataGridTemplate(ListItemType.EditItem, "Change Goals");
tcTextBoxes.FooterTemplate = new DataGridTemplate(ListItemType.Footer, "Change Goals");
dgSkills.Columns.Add(tcTextBoxes);
dgSkills.DataSource = dtshowskills;
dgSkills.DataBind();
}
public class DataGridTemplate : ITemplate
{
ListItemType templateType;
string columnName;
public DataGridTemplate(ListItemType type, string colname)
{
templateType = type;
columnName = colname;
}
public void InstantiateIn(System.Web.UI.Control container)
{
Literal lc = new Literal();
switch(templateType)
{
case ListItemType.Header:
lc.Text = "" + columnName + "";
container.Controls.Add(lc);
break;
case ListItemType.Item:
lc.Text = "Item " + columnName;
container.Controls.Add(lc);
break;
case ListItemType.EditItem:
TextBox tb = new TextBox();
tb.Text = "Hello";
container.Controls.Add(tb);
break;
case ListItemType.Footer:
lc.Text = "" + columnName + "";
container.Controls.Add(lc);
break;
}
}
}
Thanks for all your help.
|
|
|
|
|
I'm trying to get my App to always redraw some DrawLine(..) funcs when I
Code compiles ok but then blows sky high w/ "Unhandled Exception"
"Parameter Name: pen"
Help- thanks
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Text.RegularExpressions;
namespace ComplexTest2
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
//Member fields.
private bool bShowValue = false;
private PointF xyOrigin = new PointF();
private PointF cmplxValA = new PointF();
private PointF cmplxValB = new PointF();
//Compiler alert to Pen activePen;
Pen activePen;
//Indent client area to draw rectangle.
public const float xIndent = 25;
public const float yIndent = 25;
//Instantiate the Rectangle for the graph.
public RectangleF graphRect = new RectangleF(xIndent, yIndent, 450, 450);
private System.Windows.Forms.Button buttonAdd;
private System.Windows.Forms.Label labelValueAReal;
private System.Windows.Forms.Label labelValueBReal;
private System.Windows.Forms.Label labelValueAComplex;
private System.Windows.Forms.TextBox textComplexAReal;
private System.Windows.Forms.TextBox textComplexBReal;
private System.Windows.Forms.TextBox textComplexAComplex;
private System.Windows.Forms.TextBox textComplexBComplex;
private System.Windows.Forms.Label labelValueBComplex;
private System.Windows.Forms.Button complexAOK;
private System.Windows.Forms.Button complexBOK;
private System.Windows.Forms.Button button1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.textComplexAReal = new System.Windows.Forms.TextBox();
this.labelValueAReal = new System.Windows.Forms.Label();
this.labelValueBReal = new System.Windows.Forms.Label();
this.textComplexBReal = new System.Windows.Forms.TextBox();
this.textComplexAComplex = new System.Windows.Forms.TextBox();
this.labelValueAComplex = new System.Windows.Forms.Label();
this.textComplexBComplex = new System.Windows.Forms.TextBox();
this.labelValueBComplex = new System.Windows.Forms.Label();
this.buttonAdd = new System.Windows.Forms.Button();
this.complexAOK = new System.Windows.Forms.Button();
this.complexBOK = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textComplexAReal
//
this.textComplexAReal.Location = new System.Drawing.Point(144, 488);
this.textComplexAReal.Name = "textComplexAReal";
this.textComplexAReal.Size = new System.Drawing.Size(72, 20);
this.textComplexAReal.TabIndex = 0;
this.textComplexAReal.Text = "";
this.textComplexAReal.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// labelValueAReal
//
this.labelValueAReal.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.labelValueAReal.Location = new System.Drawing.Point(32, 488);
this.labelValueAReal.Name = "labelValueAReal";
this.labelValueAReal.Size = new System.Drawing.Size(104, 16);
this.labelValueAReal.TabIndex = 1;
this.labelValueAReal.Text = "Value A: Real";
//
// labelValueBReal
//
this.labelValueBReal.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.labelValueBReal.Location = new System.Drawing.Point(32, 520);
this.labelValueBReal.Name = "labelValueBReal";
this.labelValueBReal.Size = new System.Drawing.Size(104, 16);
this.labelValueBReal.TabIndex = 2;
this.labelValueBReal.Text = "Value B: Real";
//
// textComplexBReal
//
this.textComplexBReal.Location = new System.Drawing.Point(144, 520);
this.textComplexBReal.Name = "textComplexBReal";
this.textComplexBReal.Size = new System.Drawing.Size(72, 20);
this.textComplexBReal.TabIndex = 3;
this.textComplexBReal.Text = "";
this.textComplexBReal.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// textComplexAComplex
//
this.textComplexAComplex.Location = new System.Drawing.Point(408, 488);
this.textComplexAComplex.Name = "textComplexAComplex";
this.textComplexAComplex.Size = new System.Drawing.Size(72, 20);
this.textComplexAComplex.TabIndex = 4;
this.textComplexAComplex.Text = "";
this.textComplexAComplex.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// labelValueAComplex
//
this.labelValueAComplex.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.labelValueAComplex.Location = new System.Drawing.Point(240, 488);
this.labelValueAComplex.Name = "labelValueAComplex";
this.labelValueAComplex.Size = new System.Drawing.Size(144, 16);
this.labelValueAComplex.TabIndex = 5;
this.labelValueAComplex.Text = "Value A: Imaginary";
//
// textComplexBComplex
//
this.textComplexBComplex.Location = new System.Drawing.Point(408, 520);
this.textComplexBComplex.Name = "textComplexBComplex";
this.textComplexBComplex.Size = new System.Drawing.Size(72, 20);
this.textComplexBComplex.TabIndex = 6;
this.textComplexBComplex.Text = "";
this.textComplexBComplex.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// labelValueBComplex
//
this.labelValueBComplex.Font = new System.Drawing.Font("Comic Sans MS", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.labelValueBComplex.Location = new System.Drawing.Point(240, 520);
this.labelValueBComplex.Name = "labelValueBComplex";
this.labelValueBComplex.Size = new System.Drawing.Size(136, 16);
this.labelValueBComplex.TabIndex = 7;
this.labelValueBComplex.Text = "Value B: Imaginary";
//
// buttonAdd
//
this.buttonAdd.Font = new System.Drawing.Font("Comic Sans MS", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.buttonAdd.Location = new System.Drawing.Point(496, 48);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.TabIndex = 8;
this.buttonAdd.Text = "A + B";
//
// complexAOK
//
this.complexAOK.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.complexAOK.Location = new System.Drawing.Point(496, 488);
this.complexAOK.Name = "complexAOK";
this.complexAOK.TabIndex = 9;
this.complexAOK.Text = "Enter A:";
this.complexAOK.Click += new System.EventHandler(this.complexA_OK_Click);
//
// complexBOK
//
this.complexBOK.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.complexBOK.Location = new System.Drawing.Point(496, 520);
this.complexBOK.Name = "complexBOK";
this.complexBOK.TabIndex = 10;
this.complexBOK.Text = "Enter B:";
this.complexBOK.Click += new System.EventHandler(this.complexB_OK_Click);
//
// button1
//
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.button1.Location = new System.Drawing.Point(496, 384);
this.button1.Name = "button1";
this.button1.TabIndex = 11;
this.button1.Text = "Clear";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(592, 566);
this.Controls.Add(this.button1);
this.Controls.Add(this.complexBOK);
this.Controls.Add(this.complexAOK);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.textComplexBComplex);
this.Controls.Add(this.textComplexAComplex);
this.Controls.Add(this.textComplexBReal);
this.Controls.Add(this.textComplexAReal);
this.Controls.Add(this.labelValueBComplex);
this.Controls.Add(this.labelValueAComplex);
this.Controls.Add(this.labelValueBReal);
this.Controls.Add(this.labelValueAReal);
this.Name = "Form1";
this.Text = "Complex Pair";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
DrawGraphRectF(e.Graphics);
DrawXYAxes(e.Graphics);
DrawGraphXandYTicks(e.Graphics);
DrawComplexNumberA(this.CreateGraphics(), activePen, cmplxValA.X, cmplxValA.Y);
DrawComplexNumberB(this.CreateGraphics(), activePen, cmplxValB.X, cmplxValB.Y);
}
//Background "reference" rectangle
void DrawGraphRectF(Graphics g)
{
Pen rectPen = new Pen(Color.BlueViolet);
g.DrawRectangle(rectPen, xIndent, yIndent, graphRect.Width, graphRect.Height);
g.FillRectangle(new SolidBrush(Color.Snow), xIndent + 1, yIndent + 1, graphRect.Width - 1, graphRect.Height - 1);
rectPen.Dispose();
}
//Draw x and y axes.
void DrawXYAxes(Graphics g)
{
Pen axisPen = new Pen(new SolidBrush(Color.BlueViolet), 1);
g.DrawLine(axisPen, xIndent, yIndent + graphRect.Height/2, xIndent + graphRect.Width, yIndent + graphRect.Height/2);
g.DrawLine(axisPen, xIndent + graphRect.Width/2, yIndent, xIndent + graphRect.Width/2, yIndent + graphRect.Height);
axisPen.Dispose();
}
//Draw tick marks on the axes.
void DrawGraphXandYTicks(Graphics g)
{
Pen tickPen = new Pen(new SolidBrush(Color.Black), 1);
//Draw x-axis ticks and label graph.
float fxAxis = -8.0f;
float fyAxis = 8.0f;
PointF xtickPoint = new PointF(xIndent, yIndent + graphRect.Height/2);
PointF ytickPoint = new PointF(xIndent + graphRect.Width/2, yIndent);
Font labelFont = new Font("Courier",6);
SolidBrush labelBrush = new SolidBrush(Color.Black);
StringFormat strFmt = new StringFormat();
//Draw x axis ticks and float labels.
for(float fx = 2 * xtickPoint.X; fx <= graphRect.Width; fx += xtickPoint.X)
{
//string measureString = f.ToString("f1");
//float measureLength = measureString.Length;
if(fxAxis == 0.0f)
{
fxAxis += 1.0f;
fx += xtickPoint.X;
}
g.DrawLine(tickPen, fx, xtickPoint.Y - 2, fx, xtickPoint.Y + 2);
g.DrawString((fxAxis > 0? "+" : "" ) + fxAxis.ToString("f1"), labelFont, labelBrush, fx - 7, xtickPoint.Y + 7);
fxAxis++;
}
//Draw y-axis ticks and float labels.
for(float fy = 2 * ytickPoint.Y; fy <= graphRect.Height; fy += ytickPoint.Y)
{
if(fyAxis == 0.0f)
{
fyAxis -= 1.0f;
fy += ytickPoint.Y;
}
g.DrawLine(tickPen, ytickPoint.X - 2, fy, xtickPoint.Y + 2, fy);
g.DrawString((fyAxis > 0? "+" : "") + fyAxis.ToString("f1"), labelFont, labelBrush, ytickPoint.X + 5, fy - 3);
fyAxis--;
}
tickPen.Dispose();
}
private void complexA_OK_Click(object sender, System.EventArgs e)
{
Graphics g = this.CreateGraphics();
Pen activePen = new Pen(Color.Coral, 4);
//
try
{
bShowValue = true;
cmplxValA.X = (float)Convert.ToDouble(this.textComplexAReal.Text);
cmplxValA.Y = (float)Convert.ToDouble(this.textComplexAComplex.Text);
DrawComplexNumberA(g,activePen, cmplxValA.X, cmplxValA.Y);
}
catch
{
MessageBox.Show("Invalid Complex A Number", "Error!");
}
}
private void complexB_OK_Click(object sender, System.EventArgs e)
{
Graphics g = this.CreateGraphics();
Pen activePen = new Pen(Color.Green, 4);
//
try
{
cmplxValB.X = (float)Convert.ToDouble(this.textComplexBReal.Text);
cmplxValB.Y = (float)Convert.ToDouble(this.textComplexBComplex.Text);
DrawComplexNumberB(g, activePen, cmplxValB.X, cmplxValB.Y);
}
catch
{
MessageBox.Show("Invalid Complex B Number", "Error!");
}
}
void DrawComplexNumberA(Graphics g, Pen activePen, double re_, double im_)
{
g.DrawLine(activePen, (xIndent + graphRect.Width/2), (yIndent + graphRect.Height/2), (xIndent + graphRect.Width/2) + (float)(re_ * xIndent), (yIndent + graphRect.Height/2) - (float)(im_ * yIndent));
}
void DrawComplexNumberB(Graphics g, Pen activePen, double re_, double im_)
{
g.DrawLine(activePen, (xIndent + graphRect.Width/2), (yIndent + graphRect.Height/2), (xIndent + graphRect.Width/2) + (float)(re_ * xIndent), (yIndent + graphRect.Height/2) - (float)(im_ * yIndent));
}
private void button1_Click(object sender, System.EventArgs e)
{
Invalidate();
}
}
}
|
|
|
|
|
Sorry- Forgot to close some regions. Won't post so much code again...
|
|
|
|
|