|
Hi
I have done a program using thread(multithreading)
with 3 text boxes, 3 labels and a button. such that when the button is clicked,
Label 1 should become green color after the entered time period in text box1.
Label 2 should become Yellow color after the entered time period in text box2.
Label 3 should become Blue color after the entered time period in text box3.
This I have done with three threads to start these processes. that is start the three threads in the buttonclick.
Here is the coding part
sing System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;
namespace multithreadtest
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button1;
private Thread t1, t2, t3;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
t1 = new Thread(new ThreadStart(colourlabel1));
t2 = new Thread(new ThreadStart(colourlabel2));
t3 = new Thread(new ThreadStart(colourlabel3));
//
// 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.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label1.Location = new System.Drawing.Point(88, 64);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "Blue";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label2.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label2.Location = new System.Drawing.Point(208, 64);
this.label2.Name = "label2";
this.label2.TabIndex = 1;
this.label2.Text = "Green";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label3.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.label3.Location = new System.Drawing.Point(320, 64);
this.label3.Name = "label3";
this.label3.TabIndex = 2;
this.label3.Text = "Red";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(96, 24);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 3;
this.textBox1.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(208, 24);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 4;
this.textBox2.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(320, 24);
this.textBox3.Name = "textBox3";
this.textBox3.TabIndex = 5;
this.textBox3.Text = "";
//
// 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(456, 40);
this.button1.Name = "button1";
this.button1.TabIndex = 6;
this.button1.Text = "Iterate";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(680, 397);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void colourlabel1()
{
Thread.Sleep(System.Convert.ToInt32(textBox1.Text));
label1.BackColor=Color.Blue ;
}
private void colourlabel2()
{
Thread.Sleep(System.Convert.ToInt32(textBox2.Text));
label2.BackColor=Color.Green ;
}
private void colourlabel3()
{
Thread.Sleep(System.Convert.ToInt32(textBox3.Text));
label3.BackColor=Color.Red ;
}
private void button1_Click(object sender, System.EventArgs e)
{
this.button1.Enabled = false;
t1.Start();
t2.Start();
t3.Start();
}
}
}
Now I am learning system.Threading.timer class, I couldnt understand how to work with this. Can anyone please explain me how to work withthis class and can anyone add this class to the above progarm and explain me..
dhol
|
|
|
|
|
there is a good threading example on msdn
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemthreadingtimerclasstopic.asp
hth
g00fy
|
|
|
|
|
First off, it isn't right to update UI controls from a different thread. This[^] might help you understand why.
To answer your question, simply drag and drop a timer from the toolbox. Set its interval property, subscribe to its Elapsed event and you should be done.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi
In c# windows form application, can u do a small program and make me understand this concept.
I find it difficult while coming across this topic(system.threading.timer).
Its really confusing me.
so please with a small example can u sent the coding part and explain wht it does.
pls do this help..
dhol
|
|
|
|
|
hi there!
is there a way in a scrollable control to trap dockpadding changes?
like an event or a virtual method that i can override?
tnx in advance!
|
|
|
|
|
|
|
thanks!
just another thing, how about during design time?
because it's only triggered when you changed the value & reload the form...
is there a way that it's automatically triggered when you change the value even without reloading the form?
thanks again!
microsoc
-- modified at 3:45 Monday 12th September, 2005
|
|
|
|
|
I have a c# windows applicaton that contains tab pages and panels. I want to resize them during the run time.
Is there any easy way to do that. I tried to find a inbuild property, but i couldn't find. Please Help...
Thanks & Regards!
|
|
|
|
|
Have you tried the properties Dock and/or Anchor for the panes/tabs?
cheers,
[r a w]
I do not understand what I do. For what I want to do I do not do, but what I hate I do. - Romans 7:15
|
|
|
|
|
Thanks Rahul.
I will check it.
Cheers,
|
|
|
|
|
Hi
I have 4 fields as my pk in access db.. I query for data in VS.NET 2003. I query by id AND pwd.. I can view the data in datagrid, but not update properly.
When i update it says:
The changes you requested to the table were not successful because they would create duplicate values in the index, pk, or relationship. Change the data in the field or fields that contain duplicated data, remove the index, or redefine the index to permit duplicate entries and try again.
I tried to solve the problem by going to access db and changed the 'Indexed' properties (of the 4 fields i used as my pk) from 'No' to 'Yes (Duplicates OK)'. but still i get the same error when i edit values in datagrid and click on update.
Something puzzling is, when i click on view button after i update, i can see the latest AND first updated entry in my datagrid and access db. The previously edited data is changed back to the original value again.
so what im saying is,
eg. row1) 4
row2) 4
row3) 4
I changed row2) from 4 to 5 and press update. the error msg is shown. then, i press View button. i see:
row1) 4
row2) 5
row3) 4
Now i change row3) from 4 to 3. again, error is shown. now i see:
row1) 4
row2) 4
row3) 3
I tried playing with it, i update both row1) and row2) at the same time. I changed row1) to 5 and row2) to 6 and i see:
row1) 5
row2) 4
row3) 4
What's happening and what must i do exactly?? Please help asap. Thank you!
|
|
|
|
|
nidhelp wrote:
I tried to solve the problem by going to access db and changed the 'Indexed' properties (of the 4 fields i used as my pk) from 'No' to 'Yes (Duplicates OK)'. but still i get the same error when i edit values in datagrid and click on update.
You should fix your code, not hack your database. You're trying to change an index to be a value that already exists. You should not change index values at all, that is what they are for.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ok... so do u mean i should change 'Indexed' back to 'No' for all of the 4 fields?
please pardon me, but where and how do i change my codes?
here's how i got my data to show in datagrid: i used the VS.net dataform wizard to generate dataadapter and dataset... then i go to configure dataadapter and add in the Where clause... i mananged to query by id and pwd, but cant update properly... i already generated all the commands successfully using oledbadapter...
i donno where's wrong and what to change...
please help me... it's urgent...
thankful for your advice!
|
|
|
|
|
nidhelp wrote:
ok... so do u mean i should change 'Indexed' back to 'No' for all of the 4 fields?
No, I mean if you create an index column, then it should be an identity, set by the database, not by you. And you should never change it.
Personally, I think the wizards for generating dataadapters are crap, you should just write your own SQL code in a database layer in your app.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
A program I am writing uses a TabControl. Tabs are added dynamically on program init. Everything has gone fine in the development for months, but all of a sudden the program would appear to not respond when I would select an existing tab. It appears as if the UI is locked up, but the program is not using any more CPU than normal.
I have also noticed that when I shutdown, I briefly see a window that says ".NET BroadcastEventWindow 1.5.00 . . " is not responding. The window is there for only a fraction of a second, and then closes. I believe that the two might be related.
I even reverted to older code versions from before the program started happening, and see the same problem.
My program uses threads and sockets, if that makes any difference.
Any ideas on what would cause this problem? I've spent ~50 hours trying to track it down, but to no avail.
-- modified at 22:21 Sunday 11th September, 2005
|
|
|
|
|
Watch out for UI updates from threads different from the ones that created them, I've seen that cause random lockups.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
|
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.
|
|
|
|
|