|
Thank you for reply.
I have even tried giving handled = false. No results.
The texts in the textbox are not really disappearing. When I restore the form the text disappears, and when I focus the cursor over the text box the text reappears !
|
|
|
|
|
i am using C#, and in my application there are MID form and other child forms exist, i have placed a progress bar on mdi container, i want that when any child form perform its long processing then the mdi forms progress bar should progress accordingly... like internet explorer
any help or code snippet or links may be appreciable..
thanks in advance.
Regards
|
|
|
|
|
Follow some simple steps:
1. Make the progressBar internal so that child form can access it.
2. Now access the progress bar like (child.MdiParent as ParentForm).progressBar.
3. Make sure you have a synchronization mechanism is on place so that at a time only one child form can access the proressbar.
[where child is the Child Form, ParentForm is the class name of the MDI form and progressBar is the control in MDI form.]
Or,
if you do not want to expose the control as internal then create some event in Child Form like
public event EventHandler<ProgressChangedEventArgs> ProgressChanged;
Then subscribe this event in parent form like
child.ProgressChanged += Child_ProgressChanged;
void Child_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
}
and then call the event from child form like
if(ProgressChanged != null)
ProgressChanged(this, new ProgressChangedEventArgs(progressPercentage, null));
|
|
|
|
|
create an interface with the progressbar-methods and use inheritance...
(yes|no|maybe)*
|
|
|
|
|
Thanks for your replies guys..
i got the solution by making progress bar static internal.
after dragging the progress bar control on form i made its access modifier internal, and i manually changed some code of progress bar control in Designer.cs file.
through this i became able to get the progress bar like, MDIForm.PrgressBar_watinting.value=some value..
Regards
|
|
|
|
|
Are there any functions in .NET to load interlaced JPEG deinterlaced or some functions to compensate for it?
Чесноков
|
|
|
|
|
or is there a way to tell from Bitmap JPEG object if it is interlaced?
Чесноков
|
|
|
|
|
Hi Develepers
I have created a C# windows application that is able to export a Dataset that i can view on a datagridview to excel using excel Application in visual studio.
I have done this using Microsoft Interop Reference.
However i am unable to export the datagridview headers to the excel worksheet so that the users are able to see what the data is.
int i = 0;<br />
int j = 0;<br />
<br />
for (i = 0; i <= dtgView.RowCount -1; i++)<br />
{<br />
for (j = 0; j <= dtgView.ColumnCount-1; j++)<br />
{<br />
DataGridViewCell dtgcell = dtgView[j, i];<br />
excelWorksheet.Cells[i+2, j+1] = dtgcell.Value.ToString();<br />
}<br />
}
May you please give me tips on how to add the headers to the excel worksheet.
|
|
|
|
|
Well you are not expoting the dataset, you are outputting the cells of the DGV. If you were outputting the underlying datasource, and it was a datatable this would be simple blatant self promotion[^]
If you persist in outputting the DGV then why not loop through the DGV column and write out the columnheader.text before processing the cells.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well now I'm exporting using a dataset but it is still not exporting the headers to the excel worksheet.
<br />
for (i = 0; i <= dsdata.Tables[0].Rows.Count - 1; i++)<br />
{<br />
for (j = 0; j <= dsdata.Tables[0].Columns.Count - 1; j++)<br />
{<br />
data = dsdata.Tables[0].Rows[i].ItemArray[j].ToString();<br />
excelWorksheet.Cells[i+1, j+1] = data;<br />
}<br />
}<br />
|
|
|
|
|
Then loop through the table column names before you output the rows. You have the information, work out how to get it to where you need it. Table have columns and rows, you are working iwith the rows now work with the columns.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Under the Visual Source Safe, One C# form has been modified by the VS2008 automatically when open this form after this form modified in another computer. I cannot find why this happen?
modified on Wednesday, July 7, 2010 11:30 AM
|
|
|
|
|
Sorry, your question is unclear, could you rephrase that?
|
|
|
|
|
I think you may be refferring to Get Latest Version this gets the latest CHECKED IN version of the form from SS.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Before view the form, I will get the last version. But the form is still changed by the Visual Studio when open. I guess that the Unicode setting in my VS2008 is different with others. I will try to find the setting.
|
|
|
|
|
There is Class A, and other classes B, C, D for ex.
Class A contain a Method say
private void MessageRecvd(string Msg)
{
}
Now i am calling this method from B, C, D when i receive some data. If data is coming at different time , then no problem. But when all B, C, D receives data at same time, they call MessageRecvd at same time. And this leads to corrupted/loss data.
Is there a way to make the calling class to wait until the current method execution completes.
I tries like
private void MessageRecvd(string Msg)
{
lock(this)
{
}
}
Also Like
private Object lockMsgRecv = new Object();
private void MessageRecvd(string Msg)
{
lock(lockMsgRecv )
{
}
}
But unable to get the desired result.
Any help/Guidance appreciated.
|
|
|
|
|
Looks valid to me. (Especially the last one)
Have you tried inserting trace statements when your enter and exit the critical section?
|
|
|
|
|
I don't know about trace class?
I tried in debug mode in VS like
System.Diagnostics.Debug.WriteLine("Rx start -" + DateTime.Now.ToString("hh:mm:ss:fff"));
System.Diagnostics.Debug.WriteLine("Rx End - " + DateTime.Now.ToString("hh:mm:ss:fff"));
And its getting displayed consecutively like
Rx start
Rx start
Rx start
Rx end
Rx end
Rx end
How can i rectify this, also if you help me about using trace class.
Like when we use debug class its o/p prints in output window in VS.
If i use Trace class then in which window i can find its o/p.
regards
|
|
|
|
|
Trace writes to the debug window. Don't worry, System.Diagnostics.Debug.WriteLine() does exactly the same thing, except it is not conditional.
This still does not solve your problem . We've now established that your lock is not locking.
Could you post some more code:
-Thread initiation logic
-Calling statement
|
|
|
|
|
is "Rx start" inside or outside the lock?
you really should trace three things: entering the method, getting inside the lock, leaving the method.
|
|
|
|
|
Its inside lock.
|
|
|
|
|
so your lock isn't working; most likely cause: you have more than one locking object. If there are several instances of A, and you want an overall lock, make it a static member of A.
|
|
|
|
|
If you use a lock statement, then make sure that each and every object instance of A locks, using the same Object called lockMsgRecv .
You could also try implementing a singleton pattern for your class A .
Good luck!
|
|
|
|
|
Calla wrote: each and every object instance of A locks, using the same Object called lockMsgRecv.
I am not getting what you trying to say.
Do i have to put this lock on every method in class A, or when i initialize class A object in B, C, D there i have to lock on A class obj ?
Could you please explain?
|
|
|
|
|
Sorry, I'll try to make a better explanation.
What I am saying is, that if you have several instances of your class A then you cannot have a private Object in your lock statement that only A knows about.
If you create, say three instances of A , and you have defined
private Object lockMsgRecv = new Object(); in your class A , when you call the
private void MessageRecvd(string Msg)
{
lock(lockMsgRecv )
{
}
} part your of your code, your object instances of A locks on three different objects, and this will not help you in your attempt to synchronize. They must lock on the same instance to get synchronized.
B, C and D could share a lock so they make sure they don't call the critical method in A at the same time.
|
|
|
|