how i can use Assembly code in C# ?
shahramkeyboard
Posts
-
Write Assembly code in C# -
Disable Intrupt In Critical sectionHow i can disable Intrupt in Critical Section? please guid me
-
Problem in use Of ReaderWriterLockSlim Classhi 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(); }
-
Simulation Of TSL instruction For Resolve of Race ConditionHow can Write this In C#? I want Sample CODE
-
Peterson Algoritm For many ProcessHow can Write this In C#? I want Sample CODE
-
Whats iS THE Problem Of MY code in Monitor class For Resolve of Race Conditionhi 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);
-
Peterson Algoritm For many ProcessHow can use Peterson Algoritm For many Process?
-
Simulation Of TSL instruction For Resolve of Race Conditionhow can Simulate Of TSL instruction For Resolve of Race Condition? i Want to Use Thread without Race Condition By Simulate TSL how i can?
-
Trasnfer Data in datagrid in form1 to Text box in form2I 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?
-
Problem IN use Of Application.DoEvents() [modified]What Is The Problem?
-
Problem IN use Of Application.DoEvents() [modified]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 <= 500) && !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 <= 500) && !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
-
Pass Data From Data Grid in Form To Text Box in The Other FormHow 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?
-
Pass Data Between FormI 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?
-
Transfer Data From Datagrid cell IN form TO Text box IN Other Formhow can pass data from Form to Other Form
-
Transfer Data From Datagrid cell IN form TO Text box IN Other Formi 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?
-
Problem In bind DATAGRIEDyes i can save record in database but i can not view in datagrid
-
Problem In bind DATAGRIEDerror text is:Argument Eception Was Unhandled Cannot bind to the property or column tblmembers on the DataSource. Parameter name: dataMember
-
Problem In bind DATAGRIEDI WANT TO DATA SHOW IN DATAGRID BUT IN DATASOURCE EOOR error is in line:
dataGridViewX2.DataBindings.Add(new Binding("DataSource", dsDataBook, "tblbooks"));
-
Problem In bind DATAGRIEDMy 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("لطفا شابک کتاب
-
Problem In bind DATAGRIEDMY 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?