|
Hi,
I'm sitting with a weird problem.
I created an application in C# 2005 Express. It has 3 timer controls in it.
The first timer runs as a clock (system clock) and once this timer reaches a specific time during the day it runs its procedure (this works fine)
The 2nd timer has its Interval set to 10min. So every 10 minutes it needs to run its procedure.(doesn't do it)
The 3rd timer has its Interval set to 10Sec. So every 10 second it needs to run its two procedures (doesn't do it either);
Now when i run this app in debug mode everything works perfect. Breakpoints are being reached all the time, I don't see any problems. But once i publish the app and install it on a users machine it doesn't always run the procedures
As u probably realized is that this application is an auto update app which auto updates data (retrieve data from webservice then update the local SQL database)
Any help would be greatly appreciated. I need to get this working by midday tomorrow.
Any other suggestions would be great.
Thanks
|
|
|
|
|
Why don't u use threads to run your code. You can use your time to control the different threads in your app.
|
|
|
|
|
I was doing this but gets too complicated to run one procedure say at 13:00 everyday and 2 other procedures on different time intervals.
If i run a procedure under a timers tick event, isn't that set in its own thread too?
I'm just worried that if two different procedures run at the same time so they don't crash or something.
|
|
|
|
|
try logging some "I'm in this method" statements and see which code is not executed.
debug mode may work since one breakpoint pauses all threads.
|
|
|
|
|
I did that by using message boxes and it worked but then sometimes it just doesn't work.
I have changed some values it seems to be working now but i still feel unsafe.
Will do more tests thanks.
|
|
|
|
|
Hi,
When I'm trying to execute the following code, it raises exception saying that "Cross-thread operation not valid: Control 'button1' accessed from a thread other than the thread it was created on."
private void Form1_Load(object sender, EventArgs e)
{
Thread th = new Thread(threadStartServer);
th.Start();
}
private void threadStartServer()
{
string result = "";
TcpListener tcpListener1 = new TcpListener(8080);
tcpListener1.Start();
button1.Text = "Success"; // Here the exception(mentioned in subject) occurs.
}
Please let me know the solution. Thanks in advance.
|
|
|
|
|
Hello,
As the error message says it all.
Here is a solution using "InvokeRequired" and "Invoke" (google it)
private void threadStartServer()
{
string result = "";
TcpListener tcpListener1 = new TcpListener(8080);
tcpListener1.Start();
EditButtonText("Success");
}
private delegate void EditButtonTextDelegate(string strArg);
private void EditButtonText(string actText)
{
if(InvokeRequired)
{
Invoke(new EditButtonTextDelegate(EditButtonText), new object[] {actText});
return;
}
button1.Text = actText;
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
Thanks for the reply... and helped me get more familiar with the delagate/invoke technique...
|
|
|
|
|
You can also use BackGroundWorker class which has ProgressChanged event, allows to access your GUI items.
|
|
|
|
|
Thanks for the immediate reply... and helped me get more familiar with the delagate/invoke technique...
|
|
|
|
|
LalithaSJ wrote: button1.Text = "Success"; // Here the exception(mentioned in subject) occurs.
You can't access the controls which is in the main thread from a thread which is created by you. Check this[^]
|
|
|
|
|
Hello Friends,
How can i create 1D image in C#.NET.
|
|
|
|
|
Dikshant wrote: How can i create 1D image in C#.NET.
Have a think about what 1D means. How would you want to represent that?
A string is one dimensional. An image is not.
|
|
|
|
|
Colin Angus Mackay wrote: Have a think about what 1D means. How would you want to represent that?
A string is one dimensional. An image is not.
What would an image of a string be?
Knowledge is hereditary, it will find its way up or down. - Luc Pattyn
so you answer don't be scared of failure
The only failure is never to try
Things You've Never Done - Passenger -2008
|
|
|
|
|
Two dimensional. Like your browser window...
Heres a one-dimensional image library:
class OneDeeImage
{
private Color[] data;
public OneDeeImage(int width)
{
data = new Color[width];
}
}
|
|
|
|
|
i am facing a problem when m trying to send mail through remoting as system.net.mail.mailmessage is not serializabe..plz help me out
thanx
|
|
|
|
|
i think u should implement the system.net.mail.mailmessage at remoting server and from client side just send the simple text to server ....
than server sends the mail for u
|
|
|
|
|
I am developing an window application in C#.NET and i need to save data in image format so i am using Draw To Bitmap method to do that my code is
Bitmap bi = new Bitmap(panel1.Width, panel1.Height);
bi.SetResolution(3000, 3000);
panel1.DrawToBitmap(bi, new Rectangle(0, 0, panel1.Width, panel1.Height));
bi.Save(@"c:\abc.bmp", ImageFormat.Bmp);
But using this code i am able to get image but that image is not clear can any on help me so i can get clear image..
|
|
|
|
|
What do you mean when you say that the image "is not clear"?
Why are you specifying the resolution for the image? What are you going to use it for?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i have 5 scanners attached with my system. when i am scanning a barcode i want to know which scanner has scanned it. Its vert urgent....plz help if somebody knows it.....
modified on Wednesday, February 27, 2008 4:41 AM
|
|
|
|
|
In my experience - all barcode scanners act purely as a keyboard once installed. As far as I'm aware, multiple keyboards(which is effecively your scenario) CAN be used but there is no way of telling which device sent what.
There may be a way if the manufacturer(s) have provided something in the drivers than you can interact with - you need to contact them / read any documentation that came with them.
Dave
|
|
|
|
|
Dear Dave....thanks for your nice suggestion...but i have tried with all manuals came along with device..no such type of feature is mentioned....but this is the requirement and the way should be universal...means it should work with all scanners(different company's scanners).
|
|
|
|
|
What you require is probably impossible unless you write your own generic driver though I haven't a clue where you should start. C++ time for you I think - Good luck!
Dave
|
|
|
|
|
Hi,
Kindly help me, that, I want to change back ground color of any particular cell in dataGridview.
Thank you in advance
(Riaz)
|
|
|
|
|
Ever tried the BackColor property??
dataGridView1[2,3].Style.BackColor = Color.Red;
Will change the cell in row 2 column 3 BackColor to Red funnily enough.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|