PatrickShane wrote: your app freezes when the button is clicked because it's single-threaded. You should queue a user work item or spawn a new thread to do the long-running work in the background. Threading is not a solution because the 4 blocks must be performed orederly, the 1st is performed and saved then the second, and so on. Furthermore, the 2nd block reads from the data that was saved by the 1st one, and the 3rd reads from the data that was saved by the 2nd, and so on. PatrickShane wrote: Does "stop" mean it crashes or does it mean it hangs or does it mean it just seemingly mysteriously doesn't do what you expect? My application hangs due to overload, because it performe a task then save it the read from what it saved to perfrome the following task the save it, and so on. PatrickShane wrote: Run your code with the Visual Studio debugger and step through it to find the problem. The Visual Studio debugger is not helpful because I ran each block separately (block by block), and each was working and saving correctly.
ImanMahmoud
Posts
-
could any one tell me how ? -
could any one tell me how ?I have a large code under button_click event. I use XML DB. The code consists of 4 blocks of code after each one I save the data [doc.save("DBFileName.xml")]. Each block (starting from the second one) read from the data that was saved by the previous block, but when I let the 4 blocks to work totally the program stops before completeing the code under button_click event. Nearly half of the tasks are performed and saved then the program stops and does not continue. I want to add a code after each block that make the program to stop for about one or two minutes then continue performing the next block, but I do not know how ? could any one tell me how ?
-
Question in windows forms :How could i design two windows forms(Parent & child) like in MSword that the maximum size of the child form does not exceed the max size of the parent form and when maxmizing the child form its control cox still appeare below the control box of the parent form ?
-
DataGridi am sory, my problem explaination was not enough at all. first, i bound a DataTable to my DataGrid. my problem is: i have a TreeView in the same form of the dataGrid. 1. According to a specified condition I colored some of the datagrid cells (i color only the left section from the cell (assume red)). 2. For each TreeNode in this TreeView i make the value of some datagrid cells to be "true", in addition, i color the right section from this cell (assume green). In the event treeView1_AfterSelect, i empty the DataTable to receive a new data for the new TreeNode. When i do this the color of the right section (green color) is alse deleted. a) I want to keep this (green) color to be seen along all TreeNodes selection to ensure unique data selection (or no data is selected towice) for different treeNodes. b) in addition, i want to return the cells that have a "false" value and a red color thanks alot
-
DataGridI have a datagrid, all of its columns are bool columns. According to a specified condition I colored some of the datagrid cells. I want to return the colored cells that have a value = "false" when I click the button "OK"
-
Controli want, form another form, and at a specified condition, to create an object from a certain control and add it to the first form, like :
namespace Win
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1 = new Button();
private System.Windows.Forms.Button button2 = new Button();
public System.Windows.Forms.Panel panel1;public Form1() { InitializeComponent(); } static void Main() { Application.Run(new Form1()); } private void button1\_Click(object sender, System.EventArgs e) { this.Close(); } private void button2\_Click(object sender, System.EventArgs e) { Form2 f2 = new Form2(); f2.Show(); } }// Form1 public class Form2 : System.Windows.Forms.Form { private System.Windows.Forms.Button button1 = new Button() ; public Form2() { InitializeComponent(); } private void button1\_Click(object sender, System.EventArgs e) { // at a specified condition : Button b = new Button(); b.Text = "Hello" ; Form1 f1 = new Form1(); f1.panel1.Controls.Add(b); } }// Form2
}// namespace Win
this code does not work. What is the wrong here ? thanks
-
Random numberNot that. The case of m1 = m2 is not a problem, but i want the pair of two numbers (m1 and m2 together) not to be repeated. for example: if x=2 and y=3, this pair of x and y not to be repeated, because i want to use them as one unit.
-
Random numberi want to generate two random numbers , assume: Random rd = new Random(); int m1 = rd.Next(1,x); int m2 = rd.Next(1,y); i want to generate them for multiple times provided that the two numbers m1 & m2 do not repeated. thanks
-
please help me in DataGridI have a datagrid that all of its columns are BoolColumnStyle and its DataSource is a table with no relations. I relate this DG with a counter, when I mark true or false in each DataGridCell the counter adds or subtracts (respectively) a certain number. Also I relate a TreeView with this DataGrid that the previous counter works separately for each TreeNode under the TopNode in this DataGrid. I used the following code to make my datagrid to respond to one click :
private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
DataGrid.HitTestInfo hti = this.dataGrid1.HitTest(e.X, e.Y);
try
{
if( hti.Type = = DataGrid.HitTestType.Cell )
{
int r = (int)hti.Row;
int c = (int)hti.Column;
DataRow dr = table.Rows[r];
DataColumn dc = table.Columns[c];
this.dataGrid1[r,c] = !(bool) this.dataGrid1[r,c];
}
}
catch(Exception ex )
{
MessageBox.Show(ex.ToString());
}
} // dataGrid1_MouseUpI have the following problems : 1. The following message appears. I do not know what is the ListManeger or in other words, I do not understand what is the problem.
The ListManeger’s position must be equal to the rowNum.
Parameter name: rowNum Do you want to correct the value?2. The DataGrid responds to clicks even when there is no any TreeNodes are selected although I make a ckeck if (TreeView.TreeNode IsSelected). I want the DataGrid to respond to clicks only when any TreeNode under the TopNode is selected. 3. when the selected TreeNode is changed, I empty the DataGrid by the following code, but the last cell that I add a value to it remains checked :
for(int i=0 ; iThe problems 1 and 3 disturb my counter.
Please if there is a solution.
Thank you
-
A problem in DataGridI have a datagrid that all of its columns are BoolColumnStyle and its DataSource is a table with no relations. I relate this DG with a counter, when I mark true or false in each DataGridCell the counter adds or subtracts (respectively) a certain number. Also I relate a TreeView with this DataGrid that the previous counter works for each TreeNode under the TopNode in this DataGrid. I use this code to make my datagrid to respond to one click :
**private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
DataGrid.HitTestInfo hti = this.dataGrid1.HitTest(e.X, e.Y);try { if( hti.Type = = DataGrid.HitTestType.Cell ) { int r = (int)hti.Row; int c = (int)hti.Column; DataRow dr = table.Rows\[r\]; DataColumn dc = table.Columns\[c\]; this.dataGrid1\[r,c\] = !(bool) this.dataGrid1\[r,c\]; } } catch(Exception ex ) { MessageBox.Show(ex.ToString()); }
} // dataGrid1_MouseUp**
I have the following problems : 1. The following message appears. I do not know what is the ListManeger or in other words, I do not understand what is the problem. The ListManeger’s position must be equal to the rowNum. Parameter name: rowNum Do you want to correct the value? 2. The DataGrid responds to clicks even when there is no TreeNodes are selected. I want the DataGrid to respond to clicks only when any TreeNode under the TopNode is selected. 3. when the selected TreeNode is changed, I empty the DataGrid by the following code, but the last cell that I add a value to it remains checked :
for(int i=0 ; i
The problems 1 and 3 disturb my counter. Please if there is a solution. Thank you
-
Question in DataGridI designed a dataDrid (with C#) with ColumnStyles --> DataGridBoolColumn and i want this column to respond to only one click can any one help me ?
-
please, can any one help me?Hello every body and Happy New Year:rose::rose::rose: I am intended to develop a software (windows application with C#) that can coonnect to the internet. In my software i want to restriction on site access and file download. I want to prevent some users to access certain sites or downlaod certain files.:doh::doh::doh: I searched alote but with no benifits or my searh was not strong. :confused::confused::confused:I found somethings but some are web applications and the other are methods or classes stands alone, i could not combine them:(:(:( if someone can help me? :-O:-O:-O Thak you :rose::rose::rose: