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
S

shahramkeyboard

@shahramkeyboard
About
Posts
32
Topics
16
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Write Assembly code in C#
    S shahramkeyboard

    how i can use Assembly code in C# ?

    C# csharp question

  • Disable Intrupt In Critical section
    S shahramkeyboard

    How i can disable Intrupt in Critical Section? please guid me

    C# question

  • Problem in use Of ReaderWriterLockSlim Class
    S shahramkeyboard

    hi my code is:

        static ReaderWriterLockSlim rw = new ReaderWriterLockSlim();
        static Random rand = new Random();
    
        Thread\[\] AThreadReader, AThreadWriter;
        Thread ThreadReaderCreator;
        string sDataBase;
        Boolean bWriterMustAlive;
        string\[\] asReaderDataBase = new string\[10\];        
    

    private void btnRun_Click(object sender, EventArgs e)
    {
    AThreadWriter = new Thread[Int16.Parse(txtBNMWriters.Text)];
    bWriterMustAlive = true;
    for (int i = 0; i < Int16.Parse(txtBNMWriters.Text); i++)
    {
    AThreadWriter[i] = new Thread(fThreadWriter);
    AThreadWriter[i].Name = i.ToString();
    AThreadWriter[i].IsBackground = true;
    AThreadWriter[i].Start();
    }
    ThreadReaderCreator = new Thread(fThreadCreator);
    ThreadReaderCreator.IsBackground = true;
    ThreadReaderCreator.Start();
    }

        void fThreadCreator()
        {
            Random r = new Random();
            AThreadReader = new Thread\[Int16.Parse(txtBNMReaders.Text)\];
            for (int i = 0; i < Int16.Parse(txtBNMReaders.Text); i++)
            {
                int IloopLength = Int16.Parse(txtBLowerBCReaders.Text) + r.Next(Int16.Parse(txtBUpperBCReaders.Text) - Int16.Parse(txtBLowerBCReaders.Text));
                for (int j = 0; j < IloopLength; j++) ;                
                AThreadReader\[i\] = new Thread(fThreadReader);
                AThreadReader\[i\].Name = i.ToString();
                AThreadReader\[i\].IsBackground = true;
                AThreadReader\[i\].Start();
            }
        }
    
        void fThreadWriter()
        {
    
            Random r = new Random();
            int ID = Int16.Parse(Thread.CurrentThread.Name);
            int news = ID;
            while (bWriterMustAlive)
            {
                int IloopLength = Int16.Parse(txtBLowerBCWriters.Text) + r.Next(Int16.Parse(txtBUpperBCWriters.Text) - Int16.Parse(txtBLowerBCReaders.Text));
                for (int i = 0; i < IloopLength; i++) ;
                
                sDataBase = "";
                for (int i = 0; i < Int16.Parse(txtBNumbersInString.Text); i++)
                {
                    while (true)
                    {
                    rw.EnterWriteLock();
                    sDataBase += news.ToString() + " ";
                    rw.ExitWriteLock();
                    }
    
    C# help announcement lounge

  • Simulation Of TSL instruction For Resolve of Race Condition
    S shahramkeyboard

    How can Write this In C#? I want Sample CODE

    C# question

  • Peterson Algoritm For many Process
    S shahramkeyboard

    How can Write this In C#? I want Sample CODE

    C# question

  • Whats iS THE Problem Of MY code in Monitor class For Resolve of Race Condition
    S shahramkeyboard

    hi my Code IS:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Threading;

    namespace RaceCondition
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

        string s=" ";
    
    
        Thread t1, t2;
    
        private void button1\_Click(object sender, EventArgs e)
        {
            t1 = new Thread(f1);
            t2 = new Thread(f2);
            t1.Start();
            t2.Start();
            while (t1.IsAlive||t2.IsAlive)
            {
                Thread.Sleep(50);
            }
            for (int i = 0; i < s.Length; i++)
            {
                if (s\[i\]=='n')
                {
                    listBox1.Items.Add("");
                }
                else
                {
                    listBox1.Items\[listBox1.Items.Count-1\]+=s\[i\].ToString();
                }
            }
        }
    
        Random r = new Random();
        void f1()
        {
            
            Thread.Sleep(r.Next(2));
            System.Threading.Monitor.Enter(s);
            for (int i = 1; i <= 100; i+=2)
            {
    
                Thread.Sleep(r.Next(2));
                s += 'n';
                Thread.Sleep(r.Next(2));
                s += "T1 ";
                Thread.Sleep(r.Next(2));
                s += i.ToString() + "  ";
                Thread.Sleep(r.Next(2));
                s += i.ToString() + "  ";
                Thread.Sleep(r.Next(2));
                s += i.ToString() + "  ";
                Thread.Sleep(r.Next(2));
                System.Threading.Monitor.Exit(s);
            }
            Thread.Sleep(r.Next(2));
        }
    
        void f2()
        {
            Thread.Sleep(r.Next(2));
            System.Threading.Monitor.Enter(s);
            for (int i = 2; i <= 100; i += 2)
            {
    
                Thread.Sleep(r.Next(2));
                s += 'n';
                Thread.Sleep(r.Next(2));
                s += "T2 ";
                Thread.Sleep(r.Next(2));
                s += i.ToString() + "  ";
                Thread.Sleep(r.Next(2));
                s += i.ToString() + "  ";
                Thread.Sleep(r.Next(2));
                s += i.ToString() + "  ";
                Thread.Sleep(r.Next(2));
                System.Threading.Monitor.Exit(s);
    
    C# csharp linq graphics help lounge

  • Peterson Algoritm For many Process
    S shahramkeyboard

    How can use Peterson Algoritm For many Process?

    C# question

  • Simulation Of TSL instruction For Resolve of Race Condition
    S shahramkeyboard

    how can Simulate Of TSL instruction For Resolve of Race Condition? i Want to Use Thread without Race Condition By Simulate TSL how i can?

    C# question

  • Trasnfer Data in datagrid in form1 to Text box in form2
    S shahramkeyboard

    I have Form1 form1 have 2 textbox & 1 button I cLICK bUTTON 1 tHEN SHOW fORM2 form2 have ONE datagrid i Want when Click IN row then Cell[0] transfer to Text BOX in form1 how i can?

    C# question

  • Problem IN use Of Application.DoEvents() [modified]
    S shahramkeyboard

    What Is The Problem?

    C# csharp linq graphics help question

  • Problem IN use Of Application.DoEvents() [modified]
    S shahramkeyboard

    I use This CODE fOR my Program but i have to Two Click To use Button Whats IS The Problem? My Code Is Hear

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace WindowsFormsApplication13
    {
    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

        private void label2\_Click(object sender, EventArgs e)
        {
    
        }
    
        Boolean bB2ShouldStop = false;
        Boolean bB1ShouldStop = false;
        private void button1\_Click(object sender, EventArgs e)
        {
            if (label1.Text == "500")
            {
                for (int i = 1; (i &lt;= 500) &amp;&amp; !bB1ShouldStop; i++)
                {
                    label1.Text = i.ToString();
                    System.Threading.Thread.Sleep(10);
                    Application.DoEvents();
                    if (label2.Text != "500")
                    {
                        bB2ShouldStop = true;
                        label2.Text = (Int16.Parse(label2.Text) + 1).ToString();
                    }
    
                }
                bB1ShouldStop = false;    
            }            
        }
    
        private void button2\_Click(object sender, EventArgs e)
        {
            if (label2.Text == "500")
            {
                for (int i = 1; (i &lt;= 500) &amp;&amp; !bB2ShouldStop; i++)
                {
                    label2.Text = i.ToString();
                    System.Threading.Thread.Sleep(10);
                    Application.DoEvents();
                    if (label1.Text != "500")
                    {
                        bB1ShouldStop = true;
                        label1.Text = (Int16.Parse(label1.Text) + 1).ToString();
                    }
    
                }
                bB2ShouldStop = false; 
            }            
        }
    
        
    }
    

    }

    modified on Tuesday, April 20, 2010 3:48 PM

    C# csharp linq graphics help question

  • Pass Data From Data Grid in Form To Text Box in The Other Form
    S shahramkeyboard

    How can i pass Data from data grid to text box while the record in the data grid is highlighted. TEXT BOX in Form1 & DataGrid in Form2 How Can?

    C# question css

  • Pass Data Between Form
    S shahramkeyboard

    I have 2 forms. both are loaded. i wanat with click in Datagrid cell string display in Text box in Other FORM hoW can i do?

    C# question

  • Transfer Data From Datagrid cell IN form TO Text box IN Other Form
    S shahramkeyboard

    how can pass data from Form to Other Form

    C# question

  • Transfer Data From Datagrid cell IN form TO Text box IN Other Form
    S shahramkeyboard

    i have one form this form have some of textbox& have button if button clicked then we view form that consist of member i want with Doublieclick IN row of datagrid Form one cell view in text box In Other FORM HOW?

    C# question

  • Problem In bind DATAGRIED
    S shahramkeyboard

    yes i can save record in database but i can not view in datagrid

    C# database question sql-server wpf wcf

  • Problem In bind DATAGRIED
    S shahramkeyboard

    error text is:Argument Eception Was Unhandled Cannot bind to the property or column tblmembers on the DataSource. Parameter name: dataMember

    C# database question sql-server wpf wcf

  • Problem In bind DATAGRIED
    S shahramkeyboard

    I WANT TO DATA SHOW IN DATAGRID BUT IN DATASOURCE EOOR error is in line:

    dataGridViewX2.DataBindings.Add(new Binding("DataSource", dsDataBook, "tblbooks"));

    C# database question sql-server wpf wcf

  • Problem In bind DATAGRIED
    S shahramkeyboard

    My Book Business logic Layer is:

    using System;
    using System.Data;
    using System.Text;
    using System.Data.SqlClient;

    namespace Library_Project
    {
    public class bookBL
    {
    //Book properties
    private String bookcode;
    private String bookname;
    private String shabok;
    private String nasher;
    private String motarjem;
    private String mozo;

            private bookDA bookData;
    
       // BUSINESS LOGIC BOOK 
       public bookBL()            
       {
         
           //Data access layer!
     
           bookData = new bookDA();
    
       }
    
       /// <SUMMARY>
       /// Property BookCode (String)
       /// </SUMMARY>
       public String Bookcode
       {
           get
           {
               return this.bookcode;
           }
           set
           {
               this.bookcode = value;
    
    
           }
       }
    
            /// <SUMMARY>
            /// Property BooktName (String)
            /// </SUMMARY>
            public String Bookname 
            {
      
                  get
                  {
                      return this.bookname;
                  }
                  set
                  {
                        try
                        {
                            this.bookname = value;
    
                            if (this.bookname == "")
                              {
                                    throw new Exception(
                                      "لطفا نام کتاب را وارد نمایید");
                              }
                        }
                        catch(Exception e)
                        {
                              throw new Exception(e.Message.ToString());
                        }
                  }
            }
    
            /// <SUMMARY>
            /// Property ISBN (String)
            /// </SUMMARY>
            public String Shabok
            {
                  get
                  {
                        return this.shabok;
                  }
                  set
                  {
                        //could be more checkings here eg revmove ' chars
                        //change to proper case
                        //blah blah
                        this.shabok = value;
                        if (this.shabok == "")
                        {
                              throw new Exception("لطفا شابک کتاب
    
    C# database question sql-server wpf wcf

  • Problem In bind DATAGRIED
    S shahramkeyboard

    MY CONECTION STRIN IS:

    private const string CnnStr = "Data Source=(local);Initial Catalog=Library;Integrated Security=SSPI;";

    MY datagrid bind is:

    dataGridViewX1.DataBindings.Add(new Binding("Data Source", dsDataMember, "tblmembers"));

    My Database is Sql server 2008 What is the Problem?

    C# database question sql-server wpf wcf
  • Login

  • Don't have an account? Register

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