|
Put your icon in the Image property of the menu item collection in the context menu.
|
|
|
|
|
How to recieve a List of files from a ftp?
I am sending command LIST.
but recieving only:
150 Opening ASCII mode data connection for /bin/ls.
226 Transfer complete.
I am sure that on ftp must be some folders and files (ftp clients show them).
But I dont receive anything between 150 and 226.
So I read the answer from ftp:
Socket clientSocket;
string message;
byte[] buffer = byte[512];
int bytes;
while (clientSocket.Available == 0)
{
System.Threading.Thread.Sleep(50);
}
while (clientSocket.Available > 0)
{
bytes = clientSocket.Receive(buffer, buffer.Length, 0);
message += Encoding.ASCII.GetString(buffer, 0, (int)bytes);
System.Threading.Thread.Sleep(50);
}
|
|
|
|
|
If I remember correctly, FTP uses two TCP ports (20 and 21), the latter for sending/receiving commands and the former for sending/receiving data. Are you connecting to the server's port 20?
|
|
|
|
|
Thank you for idea!
The solution was so, that i was have to create one more data socket for passive mode on another port and receive data from this socket.
|
|
|
|
|
In the old days of basic we used to use a for loop to slow down the processing so the user could see changes that would happen too fast to see. (ie. changes to images in a game or data being displayed.
I am trying to show some pictureboxe changes in sequence (not animation), but the process runs so fast I only see the last change, the same with playing several wav sounds I only hear the last one.
there should be an easy way to delay the ballance of code from running so the user has time to see or hear the changes.
Thanks,
|
|
|
|
|
|
as I understand the timer's tick event, it runs whatever method you want at the set amount of ticks. But the rest of the code will be running meanwhile. did I not totaly understand, is there a way to pause the code till the tick event happens?
Thanks for your reply.
|
|
|
|
|
Do the opposite. Run the animation code only on the tick event.
|
|
|
|
|
Thanks: Will have to think about that, it might require 40-50% of my code being inside the tick event.
but will look at it.
Thanks again
|
|
|
|
|
Argus2 wrote: it might require 40-50% of my code being inside the tick event.
You can always call your code from the tick event, it needn't be literally "inside" it.
|
|
|
|
|
Use the Thread.Sleep method to make the thread wait for a number of milliseconds.
---
b { font-weight: normal; }
|
|
|
|
|
System.Threading.Thread.Sleep(1000);
will pause the thread for 1000 milliseconds.
|
|
|
|
|
Thanks that looks like it will work just fine for me..
Thanks Everyone.
|
|
|
|
|
How could i do to copy a file to a shared folder ( that shared folder is on server ) by using Windows service?
when I ran code : File.Copy("c:\\tempFile.txt","\\\\192.168.0.1\\SharedFile\\tempFile.txt",True) in windows application, it worked well. But when i used windows service, that code didn't work.
It seems that shared folder is not found when you use path:"\\\\192.168.0.1\\SharedFile\\tempFile.txt". It seems that Windows Service
will run under another desktop which is different from the logoned
interactive desktop.
So how could i access shared folder by using windows service?
Please give me some advice. Any ideas will be welcomed
|
|
|
|
|
Run the service using a domain account that has the proper permissions on both computers.
|
|
|
|
|
Thanks for your reply.
Yes, i have permission on both computers. I run following code :
<br />
'Domain account<br />
String user = "UserName";<br />
String p = "PassWord";<br />
SecureString pass = new SecureString();<br />
<br />
'Create pass<br />
for(i=0; i< p.Length; i++)<br />
pass.AppendChar(p[i]);<br />
<br />
'Copy file<br />
Process.start("cmd","/c copy c:\\temp.txt \\\\ServerName\\SharedFolder",user,pass, "DomainName");
That code run well on winform application but when running in windows service, it alerts "Access denies". It means it couldn't find the correct path to SharedFolder when using windows service.
So please tell me what correct path to access that SharedFolder by using Windows Service?
-- modified at 9:57 Sunday 26th November, 2006
|
|
|
|
|
You need to install your service itself under a domain user account. This is done in the ServiceProcessInstaller, search for something like:
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.User;<br />
this.serviceProcessInstaller1.Username = "abcd@mydomain.com";<br />
this.serviceProcessInstaller1.Password = "mypassword";
This would already be the working version. You probably have a ServiceAccount.System or something else. And null values as username and password.
Try it this way.
|
|
|
|
|
Is it possible to utilize a clientRectangle and to assign the background image to that client rectangle outside of a paint event handler? When there is a control and a background image is assigned like this:
Control ctrl = ((Control)sender);
ctrl.BackgroundImage = (path to an image file);
then the control either increases or decreases in size, then the background image is distorted or stretched in the process. However, if a control has a clientRectangle positioned on it, the clientRectangle would not be distorted or stretched accordingly. The code would be like so:
public Rectangle clientRectangle;
...
int intWidth = 78, intHeight = 109;
clientRectangle = new Rectangle(0, 0, intWidth, intHeight);
The question is, is it possible to assign a background image to the clientRectangle from the Form Load event handler instead of from a paint event handler.
It is my understanding that the PaintEventArgs from the paint event handler is required to assign the image to the clientRectangle. Is there another way that the image file could be assigned to the client rectangle, although not from the paint event handler but instead from the Form Load event handler? The code would be like so.
p.Graphics.DrawImage(imgFile, clientRectangle);
Would appreciate some input as to how to approach this issue so that the background image is not assigned to the control but instead to the clientRectangle.
-- modified at 17:15 Saturday 25th November, 2006
|
|
|
|
|
Hi
how can I create an array of threads and suspend and resume them without usin monitors?
thanks
|
|
|
|
|
Hi,
please help me if you know how…
Something is bothering me - something that I didn't know how to handle it using Visual C++, therefore I don't know how to do it now with C#.
Description:
I have form with SplitContainer control on it, where on the left side I have TreeView control, and on the right side, I would like (depending on selected item in TreeView ctrl) to have different set of other controls (buttons, editBox,…etc.)
Correct me if I'm wrong – the only easiest way that came up my mind is PANNEL control.
Number of panels should be the same as number of items in the TreeView control.
After on in the application, depending of selected item, I can use method .Hide() or .Show() to manipulate those panels.
Example
For example I have 20 items in TreeView control, therefore I should have 20 different panels.
Furthermore, when I have 20 panels on the same form, and each of them is covering right side of SplitContainer (complete area), the only panel I can see is the latest one (twentieth).
With this „panel“ concept, issue I found here is in the case if I have to change something on the third panel (e.g. to add new checkBox on it) .
How to reach third panel?
Do I have to move 17 panels to one side in order to reach third one (to be visible to work on it)?
I believe that there should be something more elegantly – but I don't know what?
I use SharpDevelop, but if you know that solution for my problem have solution in Visual Studio, please suggest!
Great example will be Computer Management Console. If you click on “Removable Storage” or “Disk Defragmenter” or any other item in TreeView control, depending on it on the right side you will have respectively related set of controls.
Thanks,
Alan
|
|
|
|
|
Change the z-order of the panels as needed; to show the third panel: Panel3.BringToFront();
|
|
|
|
|
Hi
I suggest that you have a user control for each of your panels.This way you can work on them in their own designer.
You can have a rhs panel on your form and while in runtime add the desired user control to this panel(setting its DockStyle to Fill) and remove previously added user control from this panel.
Regrads
|
|
|
|
|
Hi,
please help me if you know how…
Something is bothering me - something that I didn't know how to handle it using Visual C++, therefore I don't know how to do it now with C#.
Description:
I have form with SplitContainer control on it, where on the left side I have TreeView control, and on the right side, I would like (depending on selected item in TreeView ctrl) to have different set of other controls (buttons, editBox,…etc.)
Correct me if I'm wrong – the only easiest way that came up my mind is PANNEL control.
Number of panels should be the same as number of items in the TreeView control.
After on in the application, depending of selected item, I can use method .Hide() or .Show() to manipulate those panels.
Example
For example I have 20 items in TreeView control, therefore I should have 20 different panels.
Furthermore, when I have 20 panels on the same form, and each of them is covering right side of SplitContainer (complete area), the only panel I can see is the latest one (twentieth).
With this „panel“ concept, issue I found here is in the case if I have to change something on the third panel (e.g. to add new checkBox on it) .
How to reach third panel?
Do I have to move 17 panels to one side in order to reach third one (to be visible to work on it)?
I believe that there should be something more elegantly – but I don't know what?
I use SharpDevelop, but if you know that solution for my problem have solution in Visual Studio, please suggest!
Great example will be Computer Management Console. If you click on “Removable Storage” or “Disk Defragmenter” or any other item in TreeView control, depending on it on the right side you will have respectively related set of controls.
Thanks,
Alan
-- modified at 2:01 Sunday 26th November, 2006
|
|
|
|
|
You want to create controls based on the selected treeview item? If so why not create the controls dynamically? That is , based on the value of the selected item, you create the controls and add them to a placeholder.So instead of 20 panels all you need is a placeholder where you add your created controls to.Hope this helps....
|
|
|
|
|
Thank you for idea (better to have something than nothing).
I never did create any control dynamically - It is far easy to create control with some visual tool than to type size, distance between them,.. manually.
From another forum, one developer advice me to use "UserControl".
What do you think of that?
Thank you!
|
|
|
|