|
|
Limiting the number of parameters to methods seems like an odd idea.
However, I think some clarification is needed; by the '{0}' in the subject, do you mean limiting the number of parameters passed to things like string.Format and Console.WriteLine ?
|
|
|
|
|
Is it at all possible to install Visual C# Express Edition in your computer without having admin rights?
|
|
|
|
|
I doubt it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Yes, you just need to have enough rights to install. You don't have to be an administrator to install, several other roles have the ability. You just need to lowest one that has install rights...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Power User might be able to do it, but I haven't tried it myself.
|
|
|
|
|
Nope. Power User doesn't do it. Sighs...
|
|
|
|
|
Hello,
I have a weird problem with my c# code. It works fine on my pc sempron 1600+ but it cracks on dual core processors.
I have two classes (the main form, and one that implements some change to an image). I want to show the change in real time on the form on a picture box. So I created a thread and use delegates and beginInvoke method to refresh the pictureBox after I changed some pixels of the image that I display there.
The application works fine on low speed processors but on dual core or processor with 2ghz+ it cracks, it put the processor on 100% and does not make any changes to the pictureBox. Also I putted some breakpoints and I was stupefied, the application enters the section that changed the pixels, enters the delegate function that refresh the panel but it doesn't make any changes... I have not clue what I done wrong.
Note: I tried the Invoke method too but it the same problem.
I'm open to any suggestions
Thanks
Edit add some code
The delegates
<br />
public delegate void DelegatePictureBoxUpdate();<br />
public delegate void DelegatePictureBoxLoad(Bitmap image, int nr);<br />
public delegate void DelegateActualizareStatus();<br />
public delegate void DelegateActualizareFinal();<br />
<br />
Thread fir;<br />
ManualResetEvent m_EventStopThread;<br />
ManualResetEvent m_EventThreadStopped;<br />
<br />
public DelegatePictureBoxUpdate m_DelegatePictureBoxUpdate;<br />
public DelegatePictureBoxLoad m_DelegatePictureBoxLoad;<br />
public DelegateActualizareStatus m_DelegateStatus;<br />
public DelegateActualizareFinal m_DelegateFinal;<br />
<br />
The delegate function that loads and refresh the pctBox
<br />
public void LoadPictureBox(Bitmap final, int nr)<br />
{<br />
progressInpaint.Maximum=nr;<br />
progressInpaint.Step= nr/20;<br />
pctBoxReparat.Image=final;<br />
lblProprietati.Enabled=true;<br />
lblProprietati.Text+=":"+nr.ToString();<br />
}<br />
public void UpdateStatus()<br />
{<br />
progressInpaint.Value+=progressInpaint.Step;<br />
progressInpaint.Refresh();<br />
}<br />
<br />
void MainFormFormClosed(object sender, FormClosedEventArgs e)<br />
{<br />
<br />
if ( fir!= null && fir.IsAlive )
{<br />
m_EventStopThread.Set();<br />
<br />
while (fir.IsAlive)<br />
{<br />
if ( WaitHandle.WaitAll(<br />
(new ManualResetEvent[] {m_EventThreadStopped}), <br />
100,<br />
true) )<br />
{<br />
break;<br />
}<br />
<br />
Application.DoEvents();<br />
}<br />
}<br />
}<br />
The code in the other class:
<br />
m_form.BeginInvoke(m_form.m_DelegatePictureBoxLoad, new Object[] {final, nrPuncteDeterioate});<br />
<br />
<br />
m_form.BeginInvoke(m_form.m_DelegatePictureBoxUpdate,null);<br />
<br />
m_EventStopped.Set();<br />
modified on Wednesday, April 16, 2008 3:45 AM
|
|
|
|
|
Using some breakpoints to debug threading issues is not the best idea. If you could demonstrate what you have done maybe we can help you.
|
|
|
|
|
Hi,
I want to pass value of textbox1 that is in form1 to form2.
Thanks
|
|
|
|
|
What have you done? How are you trying to accomplish?
(delegates)
|
|
|
|
|
expose a property in the form that has the texbox and call it from the other form when you need it
public string TextBox_text
{
get{return textbox1.Text;}
}
|
|
|
|
|
Both answers you've got are good ( delegates are better ), but I will point out if you'd bothered to search the site, there is at least one excellent article on how to do this.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Can u write down whether you are working on web forms or window forms?
Sarvesh Upadhyay
Senior Software Engineer
Birlasoft India Ltd.
Microsoft Certified Professional Developer in Dotnet 2.0 Enterprise Application
|
|
|
|
|
|
Hi all,
How can i create a group textbox in form with the same name? For example i can create it easily in vb by assign index to that control.But how can i do it in c#?
Any tips are welcome.
Note: I need to do it in design time
regards
cocoon
|
|
|
|
|
You can't. You can create textboxes, but you can't create an array that contains references to them, at design time.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Isn't this close to what was there in VB?
TextBox[] aoTextBox = new TextBox[5];<br />
aoTextBox[0] = new TextBox();<br />
aoTextBox[0].Top = 5;<br />
aoTextBox[0].Left = 5;<br />
aoTextBox[0].Height = 20;<br />
aoTextBox[0].Width = 20;<br />
for(int i = 1; i < aoTextBox.Length; i++) {<br />
aoTextBox[i] = new TextBox();<br />
aoTextBox[i].Top = aoTextBox[i - 1].Top + 5;<br />
aoTextBox[i].Left = aoTextBox[i - 1].Left + 5;<br />
aoTextBox[i].Height = 20;<br />
aoTextBox[i].Width = 20;<br />
}<br />
this.Controls.AddRange(aoTextBox);
My idea of ideal life : Eat, Sleep, Repeat
|
|
|
|
|
Hi d@nish,
Thanks for your reply.Its useful to me.
|
|
|
|
|
Yeah, but he wanted design time support, so I didn't bother to point out how to do it in code. What makes more sense to me is
List<TextBox> _textboxes = new List<TextBox>(); // this is a member variable
foreach(Control control in Controls)
{
if (control is TextBox) _textboxes.Add((TextBox)control);
}
So, he gets a list of all textboxes, which he can add in the designer.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian Graus,
What you mean by "So, he gets a list of all textboxes, which he can add in the designer."?And where should i insert of your coding?
thanks in advance
regards
coccon
|
|
|
|
|
Hi,
Could you please let me know where can I get the sample XNA solutions. That solution should have used .tga files.
Thanks in advance.
|
|
|
|
|
creators.xna.com
It wouldn't matter if the solution used .tga, .bmp or .jpg... The content pipeline will do all the processing for you.
Cheers,
|
|
|
|
|
I'm coming from an embedded background using the Nucleus RTOS, and programming in C++. The system I worked on made very heavy use of constructs such as Semaphores, Mutexes, Pipes, Queues, and timers. I'm transitioning to a new project that will be using C# and .NET [I am currently unsure of what version it will be using; if it will be using the full blown .NET or the compact framework, however].
I'm trying to learn analogies for these constructs. I see that there are Mutexes, of course, but do the mutexes have timeouts available? i.e. you want to grab some resource, and if you can't grab it in X amount of time, fail, check an error condition {throw an event here instead?} and do something with that error. When we wanted to communicate between threads, we would use Pipes - we could read a pipe and suspend on it indefinitely to wait for data; or suspend on it with a timeout. What is analagous?
Also - I think I could benefit on a book that delves into these types of concepts. Most of the C#, .NET books I"ve looked at tend to go very lightly on the chapters to do with async communication. Most tend to talk about locking critical sections, but don't seem to talk about it further - a few have said these are advanced topics and are the scope of other types of books. Guess what, I need one?
Thanks all.
PS: Wasn't sure if I should post this in the C# forum or the .NET forum... Took a stab at the C# forum. Apologies if it's the wrong place.
|
|
|
|
|
Read more on the subject here[^]
|
|
|
|