|
Hi there,
I'm new to .net programming and I've been using C++/CLI to develop a new application. I now have the following problem:
I have a Timer which has an ElapsedEventHandler defined.
Acoustics::Acoustics()
{
timer = gcnew System::Timers::Timer();
timer->Elapsed += gcnew ElapsedEventHandler(this, &Acoustics::timerUpdate);
}
void Acoustics::timerUpdate(Object^ sender, ElapsedEventArgs^ e)
{
ch->LastRxSignalElapsedTime += TimeSpan::FromSeconds(0.1);
ch->LastTxSignalElapsedTime += TimeSpan::FromSeconds(0.1);
}
"ch->LastRxSignalElapsedTime" and "ch->LastTxSignalElapsedTime" are properties in this class.
In the GUI, I define some bindings to these properties:
Label ^labelchrxtimer = (gcnew Label());
labelchrxtimer->DataBindings->Add(gcnew Binding("Text", kvp.Value, "LastRxSignalElapsedTime"));
Label ^labelchtxtimer = (gcnew Label());
labelchtxtimer->DataBindings->Add(gcnew Binding("Text", kvp.Value, "LastTxSignalElapsedTime"));
Now, when ElapsedEventHandler is executed, it is in a different thread, so the labels are not automatically updated by the bindings because the properties were changed by a different thread than the one that created the labels.
How can I have the labels correctly updated?
Thanks,
Spulit
|
|
|
|
|
Hey Guys,
I have a vb.net app that I would like to have upload a text file to an ftp server. Is there a .NET class for doing this? I can't find much on "the google".
|
|
|
|
|
There's an FTP Client implementation in the System.Net namespace in the .NET Framework 2.0, called FtpWebRequest[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi all,
I have a form that contains one button and one textbox, the textbox will take a number that will be passed to another form. I have done this successfully.
The thing is that I need the second form to create a number of pictureboxes = the number received from the first form.
Any ideas?
|
|
|
|
|
sarah_malik wrote: Any ideas?
You have not really asked any question!
Creating Picture box is well documented in the MSDN
PictureBox picBox = new PictureBox();
picBox.Location = new Point(0, 0);
picBox.Size = new Size(10, 10);
picBox.TabStop = false;
picBox.SizeMode = PictureBoxSizeMode.StretchImage;
picBox.BorderStyle = BorderStyle.Fixed3D;
this.Controls.Add(picBox);
and you can loop to the number required and create any many as you wish.
If your question is on positioning of the picture boxes, then if you are using .NET 2 then consider using any of the Layout Panels objects like TableLayoutPanel.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
|
I had written my program, but it work so slow, that all work looks like one big photo album. I tried optimizate with visual studio, but it gave nothig.
What could I do to increse program working speed?
|
|
|
|
|
Well without knowing anything about your program it is hard to say. But here are some things to look at.
What graphics methods are you using? I don't know alot about all of them but I know that setpixel and getpixel are really slow.
Do you have unnecisary calculations inside of a loop? In other words if you have a value that will remain the same for the duration of a loop, calculate its value outside the loop so your program doesn't have to repeat the operation thousands or millions of times.
Are you rediming large arrays constantly? In particular redim preserve is slow because the computer is actually making a new array and copying the contents over from the old one.
I hope this helps,
Mike
|
|
|
|
|
I use two picturebox's arrays, wich have 10 elenemts, two timers. My form is maximized and transparent. Then the form wasn't trasnparent, program was going on the right speed.
|
|
|
|
|
There are any number of reasons as to why your program could run slowly. We don't have enough information to give you an informed opinion. I would guess, though, that you may have memory issues. Take a look in Task Manager and see how much memory your application is using. If it looks as though it's chugging memory like Duff beer, take a look at this article:
http://www.marcclifton.com/tabid/79/Default.aspx[^]
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Best thing to do would be to post the sub/function that you think is acting slowly (not the whole program) with a little explaination of what you are trying to do with it. Even if I don't have the answer someone else may. Otherwise we can only guess what the problem is.
If you are not sure which sub/function is the problem then try setting some breakpoints and run through your program and see where it is getting hung up.
|
|
|
|
|
private: System::Void tmr_for_move_Tick(System::Object^ sender, System::EventArgs^ e) {
Move_usr();
if(b_usr.pct->Visible == true) Move_bl_usr();
for(int i=0; i<n; i++){
Move_em(i);
if(b_em[i]->pct->Visible == true) Move_bl_em(i);
if(b_usr.pct->Visible == true) Check_hit_em(i);
if(b_em[i]->pct->Visible == true) Check_hit_usr(i);
else if(em[i]->pct->Visible == true) Shooting_em(i);
}
}
private: void Move_em(int i){
if(em[i]->pct->Left + em[i]->step_x > min_x && em[i]->pct->Left + em[i]->step_x < max_x)
em[i]->pct->Left += em[i]->step_x;
else em[i]->step_x *= -1;
if(em[i]->pct->Top + em[i]->step_y > min_y && em[i]->pct->Top + em[i]->step_y <= max_y)
em[i]->pct->Top += em[i]->step_y;
else em[i]->step_y *= -1;
if(em[i]->pct->Left == max_x) em[i]->step_x = - em[i]->step_x;
if(em[i]->pct->Top == max_y - 58) em[i]->step_y = - em[i]->step_y;
if(em[i]->step_x > 0) em[i]->pct->Load("e_r.jpg");
else if(em[i]->step_x < 0) em[i]->pct->Load("e_l.jpg");
if(em[i]->step_y > 0) em[i]->pct->Load("e_d.jpg");
else if(em[i]->step_y < 0) em[i]->pct->Load("e_u.jpg");
}
Other procedures are same, but move different object.
private: object usr, b_usr;
private: static unsigned short int hits = 0;
private: static unsigned short int n = 10;
private: static unsigned short int m = 32;
private: static array<object^>^ em;
private: static array<object^>^ b_em;
ref struct object {
int step_x, step_y;
System::Windows::Forms::PictureBox^ pct;
};
|
|
|
|
|
Hi,
So the form's transparancy is the key factor. Does it have to be transparant ?
And are you using double-buffering ? If not, I would recommend you try it.
|
|
|
|
|
what do you mean saying "double-buffering" ?
-- modified at 10:39 Tuesday 13th March, 2007
I find out what is double-buffering, and added. It really helped. Tank you all for your help.
|
|
|
|
|
There's probably a couple dozen different ways of doing this, each different for different situations. It depends, very specifically, what you mean by "overlap image".
Are you talking about an image in each of two controls? Are you talking about drawing the images yourself? Is transparency involved? What are you doing with these images? Are you doing any painting on them? Stamping an image onto another? The list goes on and on...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi friends....
I m developing a windows application in c# in .net framework and i want this application to run at windows start up. Please help me ASA possible
thanks
|
|
|
|
|
Then add it to the start up folder on the programs menu.
|
|
|
|
|
Do you want it to run at Windows Startup or when the user logs in?
If it's when the user logs in, you can add a shortcut to your app to the Startup folder, or run it from the registry's Run key.
If it's when Windows Starts, you'll have to write your app as a Windows Service.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Which of these will you describe as horizontal(X) and which vertical(Y)?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Guess and check
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi All !!
Pls help....i dont know much of .NET and have been given an assignment to search files in a server according to filename and extension. The files are stored in StarTeam repository and we have to use a FileCollection object to store the files from Server and search it. I am able to connect to Server and find the directory where the files have been stored..But how to load them into FileCollection, i am not able to get..Please help...
I have written something like--->
<br />
private Borland.StarTeam.FileCollection filecol;<br />
private Borland.StarTeam.Server Server;<br />
private Borland.StarTeam.ServerAdministration ServAdmn;<br />
<br />
private Borland.StarTeam.Folder rtFolder = Server.Projects[0].Views[0].RootFolder;<br />
String strRootPath = rtFolder.Path;<br />
<br />
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo("ServerIpAddress\\" + strRootPath + "\\" );
foreach (System.IO.FileInfo f in dir.GetFiles(filename))<br />
{ <br />
listBox1.Items.Add(f.Name);<br />
}<br />
<br />
Please help how to search files in remote system..Is there any other dedicated method other than System.IO.DirectoryInfo class method's that can fulfil the purpose...
Thanks in advace.
|
|
|
|
|
The remote server path would be formatted like this:
\\serverName\shareName\filePath
or you can use the servers IP address in place of serverName .
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I'm searching anyone who like to participate to a new open source project team core , if you are interset , please come here to know more:
http://simorgh.sepantahost.com
I like to discuss more:
m.farshadmehr@sepanta.com
|
|
|
|
|
It would have been nice, if you could have explained a few words about the project. Also, codeproject facilitates URLs to be hyperlinked by pasting it into the textbox.
|
|
|
|
|