Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
D

dhol

@dhol
About
Posts
58
Topics
42
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • parent and child nodes
    D dhol

    Hi i am working in c# with infragistics In c# windows applicaion, I will be passing data from textbox..such that for example:i havE 3 texboxes labeled name: age: salary:.... Now name is the parent and age and salary r the child..so if i pass data in the appropriate textbox..It should be added in the ultrawintree.......such that name(parent) should show up on the root node of the tree. and age and salary(child) should show up under the root node. so now when I run this program, as it reads a xml schema and creates a xml file.. now when I clicked the ADD button, it checks for the xml file and each textbox is binded to the xml elements..so that the data which is passed in the xml file willbe added in the xml.. now for example i gave john,22,1800 for name,age and salary respectively and again john,45,3800 so it should be shown in teh tree as follows tht john under john both ages and salary should be shown ie like parent(name) : john child(age) : 22 45 child(salary): 1800 3800 but i am getting teh result as follows.. john 22 1800 and again john 45 3800 seperately.... so please tell me how to do it. here is my coding part //FUNCTION FOR ADDINGNODES private void AddNode(string ParentNAME, string AGE, string SALARY) { //add parent node Infragistics.Win.UltraWinTree.UltraTreeNode parentNAMEnode = new Infragistics.Win.UltraWinTree.UltraTreeNode(); Infragistics.Win.UltraWinTree.UltraTreeNode AGEnode = new Infragistics.Win.UltraWinTree.UltraTreeNode(); Infragistics.Win.UltraWinTree.UltraTreeNode SALARYnode = new Infragistics.Win.UltraWinTree.UltraTreeNode(); //add parent node parentNAME.Text = ParentNAME; //other nodes AGEnode.Text = AGE; SALARYnode.Text = SALARY; //add childnodes to parent parentNAMEnode.Nodes.Add(AGEnode); parentNAMEnode.Nodes.Add(SALARYnode); parentNAMEnode.Expanded = true; //add teh nodes to teh ultratree ultraTree1.Nodes.Add(parentNAMEnode); } //ADD button private void button1_Click(object sender, System.EventArgs e) { DataSet dataSet = new DataSet(); // Read the existing xml dataSet.ReadXml("..\\..\\resultdata.xml"); //PARENTName TEXTBOX string strParentNAME = txtParentNAME.Text; //AGE Text box----int type string strAGE = txtAGE.Text; int intAGE; if (!strAGE.Equals(string.Empty)) // check to make sure the user entered something intAGE = Convert.ToInt32(strAGE); //SALARY Text box----int type string strSALARY =

    C# xml tutorial csharp database data-structures

  • error: key already exists
    D dhol

    Hi i am working in c# with infragistics In c# windows applicaion, I will be passing data from textbox..such that for example:i haev 3 texboxes labeled name: age: salary:.... Now name is the parent and age and salary r the child..so if i pass data in the appropriate textbox..It should be added in the ultrawintree.......such that name(parent) should show up on the root node of the tree. and age and salary(child) should show up under the root node. I did this as follows.. //ultrawintree private Infragistics.Win.UltraWinTree.UltraTree ultraTree1; //form load private void Form1_Load(object sender, System.EventArgs e) { DataSet dataSet = new DataSet(); //read the schema dataSet.ReadXmlSchema("..\\..\\Menu.xsd");//menu.xsd contains name, age and salary dataSet.WriteXml("..\\..\\resultdata.xml",XmlWriteMode.WriteSchema); } //buttton click private void button1_Click(object sender, System.EventArgs e) { DataSet dataSet = new DataSet(); // Read the existing xml dataSet.ReadXml("..\\..\\resultdata.xml"); //name textbox----string type string strName = txtName.Text; //age text box----int type string strage = txtAge.Text; int intAge; if (!strAge.Equals(string.Empty)) // check to make sure the user entered something intAge = Convert.ToInt32(strAge); //Salary textbox------int type string strSalary = txtSalary.Text; int intSalary; if (!strSalary.Equals(string.Empty)) // check to make sure the user entered something intSalary = Convert.ToInt32(strSalary); //create a new row DataRow newrow; newrow = dataSet.Tables[0].NewRow(); // add new row. newrow["Name"] = strName; newrow["Age"] = strAge; newrow["Salary"] = strSalary; //add parent node in ultrawintree Infragistics.Win.UltraWinTree.UltraTreeNode anode = new Infragistics.Win.UltraWinTree.UltraTreeNode(); //add parent node anode.Text = txtName.Text; //add child nodes anode.Nodes.Add(txtAge.Text); anode.Nodes.Add(txtSalary.Text); anode.Expanded = true; ultraTree1.Nodes.Add(anode); //add the row to the dataset dataSet.Tables[0].Rows.Add(newrow); //write the data to a xml file dataSet.WriteXml("..\\..\\resultdata.xml", XmlWriteMode.WriteSchema); dataSet.AcceptChanges(); MessageBox.Show("Saved"); } so now when i run this program, as it reads a xml schema and creates a xml file.. n

    C# xml csharp database data-structures help

  • doubt in Infragistics.Win.UltraWinTree
    D dhol

    Hi i am working in c# with infragistics In c# windows applicaion, I will be passing data from textbox..such that for example:i ahev 3 texboxes labeled name: age: salary:.... Now name is the parent and age and salary r the child..so if i pass data in the appropriate textbox..It should be added in the [B]ultrawintree..[/B]such that name(parent) should show up on the root node of the tree. and age and salary(child) should show up under the root node. as I am new to infragistics , I am learning. Please help me with coding..and please explain me ... dhol

    C# csharp data-structures help tutorial career

  • creat a xml with data appending on the other
    D dhol

    Hi I have did a program such that , i will have two text box name and age in my form..and a button named save. so that when the values entered r in the text box..a xml file is created with those data.. . Now I can able to create one set of values…. Now what I need is that when again some other value is entered in the textbox. It should also be written in the xml file..but without deleting the other. I mean it should append on the other.. For example: first I entered first as john and 22 for name and age ..it will added in the xml file..now again if I enter charu and 23 as name and age.. Now xml should have john and 22 as well as charu and 23… And also one more thing is that if I again enter John. It should give a message that it has already been entered. No values should be repeated again. Please help me to do this….. The coding which I did is as follows. In side the button click //save Button private void button1_Click(object sender, System.EventArgs e) { DataSet dataSet = new DataSet(); //read the schema dataSet.ReadXmlSchema("..\\..\\PlaygroMenu.xsd"); //create a new row DataRow oValues; oValues = dataSet.Tables[0].NewRow(); //enter the values oValues[0] = txtName.Text; oValues[1] = Convert.ToInt32(txtAage.Text); //check for duplication bool hasalready = false; foreach(DataRow row in dataSet.Tables[0].Rows) { if(row.ItemArray[0].ToString().Equals(txtID.Text)) { hasalready = true; } } // if(!hasalready) { //add the row to the dataset dataSet.Tables[0].Rows.Add(oValues); //write the data to a xml file dataSet.WriteXml("..\\..\\resultdata.xml", XmlWriteMode.WriteSchema); MessageBox.Show("Saved"); } else { MessageBox.Show("Already Exists"); } } private void Form1_Load(object sender, System.EventArgs e) { DataSet dataSet = new DataSet(); //read the schema dataSet.ReadXmlSchema("..\\..\\Menu.xsd"); System.IO.FileInfo file = new System.IO.FileInfo("..\\..\\mydata.xml"); //check whethere there is result xml file... if (file.Exists) { dataSet.ReadXml("..\\..\\resultdata.xml"); } } Please help me to do this.. Dhol

    C# xml database help tutorial

  • help in creating a xml
    D dhol

    Hi I have did a program such that , i will have two text box name and age in my form..and a button named save. so that when the values entered r in the text box..a xml file is created with those data... Now I can able to create one set of values…. No what I need is that when again some other value is entered in the textbox. It should also be written in the xml file..but without deleting the other. I mean it should append on the other.. For example: first I entered forst as john and 22 for name and age ..it will added in the xml file..no again if I enter charu and 23 as name and age.. Now xml should have john and 22 as well as charu and 23… And also one more thing is that if I again enter John. It should give a message that it has already been entered. No values should be repeated again. Please help me to do this….. The coding which I did is as follows. In side the button click //save Button private void button1_Click(object sender, System.EventArgs e) { DataSet dataSet = new DataSet(); //read the schema dataSet.ReadXmlSchema("..\\..\\PlaygroMenu.xsd"); //create a new row DataRow oValues; oValues = dataSet.Tables[0].NewRow(); //enter the values oValues[0] = txtName.Text; oValues[1] = Convert.ToInt32(txtAage.Text); //check for duplication bool hasalready = false; foreach(DataRow row in dataSet.Tables[0].Rows) { if(row.ItemArray[0].ToString().Equals(txtID.Text)) { hasalready = true; } } // if(!hasalready) { //add the row to the dataset dataSet.Tables[0].Rows.Add(oValues); //write the data to a xml file dataSet.WriteXml("..\\..\\resultdata.xml", XmlWriteMode.WriteSchema); MessageBox.Show("Saved"); } else { MessageBox.Show("Already Exists"); } } private void Form1_Load(object sender, System.EventArgs e) { DataSet dataSet = new DataSet(); //read the schema dataSet.ReadXmlSchema("..\\..\\Menu.xsd"); System.IO.FileInfo file = new System.IO.FileInfo("..\\..\\mydata.xml"); //check whethere there is result xml file... if (file.Exists) { dataSet.ReadXml("..\\..\\resultdata.xml"); } } Please help me to do this.. Dhol

    C# xml database help tutorial

  • help in creating a xml
    D dhol

    I have did a program such that , i will have two text box name and age in my form..and a button..so that when the values entered r in the text box..a xml file is created with those data... and my coding is as follows. Inside the burtton click, th e coding is as follows //create a dataset DataSet dataSet = new DataSet(); //read the schema dataSet.ReadXmlSchema("d:\\Menu.xsd"); //create a new row DataRow newrow; newrow = dataSet.Tables[0].NewRow(); //enter the values newrow[0] = Convert.ToInt32(txtName.Text); newrow[1] = Convert.ToInt32(txtAge.Text); //add the row to the dataset dataSet.Tables[0].Rows.Add(newrow); //write the data to a xml file dataSet.WriteXml("D:\\myData.xml", XmlWriteMode.WriteSchema); MessageBox.Show("saved"); Now i have one doubt.. ie, the program which i did ..now ..in the form...when i am giving data as for name: john age:22... now myData.xml wil be saved with those data ... Now if i am clearing those vaues in th textbox and adding some other data... that should be added without deleting the previous data... and also if i am entering again john..it should show that already it exists.... please say how to do this...

    C# xml database help tutorial

  • load a .gif image at runtime in crystal report
    D dhol

    Hi I have done a program in C# such that , added a crystal report viewer, then added a button named as browse… and designed a report by getting source from the xml schema file(.xsd file) with two fields namely name,image..... name is of string datatype and image is of datatype base64Binary.. so now when I run the program.. using browse button I can be able to load a .jpg image at runtime.. so that image will be displayed in the report…. This is wht my program does… Now what I have to do is that ,I should be able to load a .gif image at runtime and display in crystal report.At present when I select a .gif image..its not shown in crystal report…so please help me to do this.. I will enclose my coding part along with this..please have a look at it and help me to do this program…. and the coding is as follows: // Prcocedure: AddImageRow // reads an image file and adds this image to a dataset table // void AddImageRow(DataTable tbl, string name, string filename) { FileStream fs = new FileStream(filename, FileMode.Open); // create a file stream BinaryReader br = new BinaryReader(fs); // create binary reader DataRow row; // create a new datarow row = tbl.NewRow(); // set country field and image field row[0] = name; row[1] = br.ReadBytes((int)br.BaseStream.Length); // add this row to the table tbl.Rows.Add(row); // clean up br = null; fs = null; } //Browse button private void button1_Click(object sender, System.EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); // openFileDialog1.Filter = "Image Files(*.jpg) | *.jpg "; openFileDialog1.Filter = "Image Files(*.jpg) |*.jpg | All Files(*.*) | *.*"; openFileDialog1.ShowDialog(this); //the variable myPic contains the string of the full File Name,it includes the full path. string mypic = openFileDialog1.FileName; DataSet data = new DataSet(); // add a table 'Images' to the dataset data.Tables.Add("Images"); // add two fields data.Tables[0].Columns.Add("Country", System.Type.GetType("System.String")); data.Tables[0].Columns.Add("img", System.Type.GetType("System.Byte[]")); AddImageRow(data.Tables[0],mypic,mypic); // create a report showimage cr = new showimage(); cr.SetDataSource(data); // pass a reportdocument to the viewer crystalReportViewer1.ReportSource = cr; }

    C# xml csharp database help

  • save aimage from the form in .jpeg format
    D dhol

    Hi Using Microsoft.ink...I have to draw a image in the form and save that image in .jpeg format.....So i haveto install Microsoft Tablet pc..... so finally I installed ... and i did a program with 2 buttons in the form namely SAVE and EXIT...... so now when i run this program..i can able to draw a image of my own in the form..now when i click save button...i should be able to save the image in .jpeg format.. BUT I couldnt save.. when i click the SAVE button..and give a name for the image .... an error is shown... ERROR MESSAGE: System.NullReferenceException: Object reference not set to an instance of an object. at InkImage.Form1.button2_Click(Object sender, EventArgs e) in d:\inkimage\form1.cs:line 144.. ie, error in the last line of this program [ DrawArea.Save( sfd.FileName, format );] using System; using System.Drawing; using System.Drawing.Imaging; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using Microsoft.Ink; using System.IO; namespace InkImage { public class Form1 : System.Windows.Forms.Form { // Declare the Ink Collector object private InkCollector myInkCollector; private const float ThinInkWidth = 50; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private Bitmap DrawArea;// make a persistent drawing area private void Form1_Load(object sender, System.EventArgs e) { // Create a new ink collector and assign it to this form's window myInkCollector = new InkCollector(this.Handle); // Set the pen width to be a width myInkCollector.DefaultDrawingAttributes.Width = ThinInkWidth; // Turn the ink collector on myInkCollector.Enabled = true; } //EXIT BUTTON private void button1_Click(object sender, System.EventArgs e) { myInkCollector.Enabled = false; this.Dispose(); } //SAVE BUTTON private void button2_Click(object sender, System.EventArgs e) { ImageFormat format = ImageFormat.Jpeg; SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "JPEG Files(*.jpg)|*.jpg"; if (sfd.ShowDialog() == DialogResult.OK) { // now save the image in the DrawArea DrawArea.Save( sfd.FileName, format ); } } } } please help me to get the solution...... D h o l

    C# graphics help mobile

  • Using Microosft.Ink
    D dhol

    Hi I have to use Microsoft.ink in c# and , and just draw a image .. for example: just write a letter say egg using ink and save that image as .jpeg file.. How can i do it . Please anyone tell how to do this.. Dhol

    C# tutorial csharp question

  • image at runtime
    D dhol

    Hi , I am working in c# with crystal report XI. I read an example about dynamic image location .. 1) In that we have a xml xchema file with two fields n amed country--datatype is string, img--datatype is base64Binary. using this as the datasource,i have designed the crytal report. And a parameter is set asking for the name. 2) I have designed teh form by adding a crystal report viewer and now the coding part is as follows // Prcocedure: AddImageRow // reads an image file and adds this image to a dataset table // // [in] tbl DataTable // country name of a country // filename name of an image file // void AddImageRow(DataTable tbl, string name, string filename) { FileStream fs = new FileStream(filename, FileMode.Open); // create a file stream BinaryReader br = new BinaryReader(fs); // create binary reader DataRow row; // create a new datarow row = tbl.NewRow(); // set country field and image field row[0] = name; row[1] = br.ReadBytes((int)br.BaseStream.Length); // add this row to the table tbl.Rows.Add(row); // clean up br = null; fs = null; } // Function: CreateData // Creates a dataset that has 1 table with two fields: Country (string), and img (blob/byte[]) // Adds four records to this table // DataSet CreateData() { DataSet data = new DataSet(); // add a table 'Images' to the dataset data.Tables.Add("Images"); // add two fields data.Tables[0].Columns.Add("Country", System.Type.GetType("System.String")); data.Tables[0].Columns.Add("img", System.Type.GetType("System.Byte[]")); // add rows AddImageRow(data.Tables[0], "argentina", Directory.GetCurrentDirectory() + "\\argentina.jpg"); AddImageRow(data.Tables[0], "canada", Directory.GetCurrentDirectory() + "\\canada.jpg"); return (data); } // Procedure: CreateReport // Creates a report and passes the dataset // void CreateReport() { // create a report CrystalReport1 cr = new CrystalReport1(); cr.SetDataSource(CreateData()); // pass a reportdocument to the viewer crystalReportViewer1.ReportSource = cr; } public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // CreateReport(); } This is the coding part..ie,when the program is run the image which is existing in the directory (say argentina.jpg and canada.jpg). it will ask for country name...so if we type canada..then canada.jpg wil be displyed in

    C# csharp xml tutorial

  • Dynamic Image Location in Crystal Report XI
    D dhol

    Hi I am working with Crystal reports XI. Dynamic Image location is possible in CR XI... But I couldnt understand teh example given for dyanmic image location in businessobjects.com... so please anyone witha small example explain to me how to do it using c#. dhol

    C# tutorial csharp com

  • Loading a image at runtime in Crystal report XI
    D dhol

    HI, I am working in crystal reports XI. In this I have to code in C# such that , it have to load a image at run time in crystal ReportXI . I searched a lot in net but couldnt do the thing which i want to do. I found that Dyanmic image location in crystal reprot XI , a advantage in CR-XI. But I dont know how to do this ... In the future I willbe working with many application based on this concept. so please any one explain how to do . or send the coding part .... j s -- modified at 1:07 Friday 7th October, 2005

    C# csharp tutorial

  • run a application at a specified time
    D dhol

    Hi I have to do a program in c# windows application such that form employs with a textbox, Progress bar, label and abutton. I have to use system.threading.timer such that , when a time is given in the textbox, (say 02:30 PM),then the progress bar progresses and at last after progress bar finishes , the label which is in the form should turn red colour at that specified time(ie, 02:30 PM).. How o do this .Please help me to do this application. js

    C# csharp javascript help

  • help in this program
    D dhol

    Hi I have to do a program in c# windows application such that form employs with a textbox, Progress bar, label and abutton. I have used system.threading.timer such that , when a time is given in the textbox, (say 02:30 PM),then the progress bar progress and at last after progress bar finishes, the label which is in the form should turn red colour at that specified time(ie, 02:30 PM).. but, I had a doen a program to such extent that when a time is given in textbox(say 02:30 pm) then the progress bar progresses and finishes soon and the label turns into red colour. Burt not at the specified time(ie, 02:30 pm).. here is ,my part of coding. Please help me to do the the thing. private class ThreadRunner { private Form1 _form; private int _delay; private System.Threading.Timer _timer; public ThreadRunner(Form1 mainForm,int delayInSeconds) { _form=mainForm; _delay=delayInSeconds; } public void Go() { // Create a timer passing in a delegate to the TimerElapsedmethod // null is to be passed as a parameter to Timerelapsed //0-start immediately //10--cal a callback everysecond _timer=new System.Threading.Timer(new TimerCallback (this.TimerElapsed),null,1000,1000); while (_timer!=null) Thread.Sleep(0); // Do nothing until timer has stopped } public void TimerElapsed(object o) { _delay--; _form.Invoke(new MethodInvoker(_form.UpdateProgress)); if (_delay<=0) { _form.Invoke(new MethodInvoker(_form.UpdateLabel)); _timer.Dispose(); _timer=null; } } } //then inside teh button click private void button1_Click(object sender, System.EventArgs e) { DateTime current = System.DateTime.Now; DateTime end = DateTime.Parse(textBox1.Text); TimeSpan ts = end.Subtract(current); //value entered in the textbox int timeToRun= System.Convert.ToInt32(ts.Seconds); //set the maximum range of value progressBar1.Maximum=timeToRun; progressBar1.Step=1; ThreadRunner tr=new ThreadRunner(this,timeToRun); Thread t=new Thread(new ThreadStart(tr.Go)); t.Start(); } this is the coding part which i had done.please explain and tell me wher to change and finish it . dhol

    C# csharp help

  • dateTime format
    D dhol

    Hi I have done a program using system.threading.timer.... now in that i will input the time in a textbox, say 03:00 pm.. now i have to format in that way, i mean hour:minute.. here is the part of my coding //system timing DateTime current = System.DateTime.Now; //texbox,wher i wil give time DateTime end = DateTime.Parse(textBox1.Text); .//then i willcalculate the timespan. TimeSpan ts = current.Subtract(end); but only in the second part of my coding. i willgive as 03:00 pm in the textbox,which should be accepted. so please help me how to format the datetime. I read from MSDN and articles to use {t} , but i dont know exactly how to implement.. so please help me by explaining how to code that part.. js

    C# help question

  • dateTime format
    D dhol

    Hi I have doen a program, her is some part of the coding DateTime current = System.DateTime.Now; DateTime end = DateTime.Parse(textBox1.Text); TimeSpan ts = current.Subtract(end); I am calculating as follows. But now i want to know the default format of dateTime. in texBox1.text, i will give a time.... then that sould be calculated fromteh current time of teh system. so i want to give only the time like 3:00 ..i mean in hrs and minutes.... so how do i format these. pls help me to do this . dhol

    C# help question

  • use of system.threading.timer
    D dhol

    Here is a small example which i did, Create a form with button, label, textbox, and progressbar on it (I just use the default names in this example). Create two methods on the form, one that updates the label, and one that updates the progress bar. Code: private void UpdateLabel() { label1.BackColor=Color.Red; } private void UpdateProgress() { progressBar1.PerformStep(); } Create a class that does the thread work, in this case it will start a timer, and invoke methods above for the form each time the timer elapses. Code: private class ThreadRunner { private Form1 _form; private int _delay; private System.Threading.Timer _timer; public ThreadRunner(Form1 mainForm,int delayInSeconds) { _form=mainForm; _delay=delayInSeconds; } public void Go() { _timer=new System.Threading.Timer(new TimerCallback(this.TimerElapsed),null,0,10); while (_timer!=null) Thread.Sleep(0); // Do nothing until timer has stopped } public void TimerElapsed(object o) { _delay--; _form.Invoke(new MethodInvoker(_form.UpdateProgress)); if (_delay<=0) { _form.Invoke(new MethodInvoker(_form.UpdateLabel)); _timer.Dispose(); _timer=null; } } } Add code to start an object of the class defined above: Code: private void button1_Click(object sender, System.EventArgs e) { int timeToRun=Int32.Parse(textBox1.Text); progressBar1.Maximum=timeToRun; progressBar1.Step=1; ThreadRunner tr=new ThreadRunner(this,timeToRun); Thread t=new Thread(new ThreadStart(tr.Go)); t.Start(); } Inthis u can see that for a specify seconds in the textbox, ,label glows red after the progress bar completes. so now wht i need is that to do another thing in the above example,that is ..that giving a time in the text box....say 3:00 pm.... then the label should turn red at 3:00pm.. i mean giving the system timing ,... then we should give a time in the text box, then the button click property should be done at the specified time in the text box. how can i do this in the above method....please can u help me to do this. js -- modified at 3:39 Tuesday 13th September, 2005

    C# javascript help tutorial question

  • system.threading.timer
    D dhol

    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

    C# graphics docker

  • system.threading.timer
    D dhol

    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

    C# graphics docker

  • Multithreading in c# windows application
    D dhol

    Hi I have to work on multithreading concepts in c# windows application. Design a form with 3 labels and 3 text boxes and a button. I should enter the time in three text boxes. Three different times. And press the Button. 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. I should have three threads to start three processes. Start the three threads in the button click. Thread 1 to start the thread and wait for the entered time in text box 1 and make the label 1 green. And so on. U should enter the time in milli seconds. 1 second = 1000 milliseconds. So if I want to enter 5 seconds. I should enter 5000 in the text box. I should Write a windows application for this. Pls anyone explain me how to do this . pls help me to do this sample. dhol

    C# csharp design help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups