|
Hey all.
First of all, please keep in mind that i am far from a proffesionel programmer, so dont go to hardcore on me.
The actual Q:
I have made a C# windows form, that connect to a remote mssql database, receives data, and plots it into a gridview. U can also add new data to the sql database. I made it update everytime u focus it, or change values. This however causes the program to hang all the time. Is there anyway to make it update in the background, perhaps every 10 secs, and then just pick of the most reason local version, everytime u focus it? I use tableadapter and dataset to store and edit the data in. Perhaps u could make it update the dataset in the background?
Anyways, i hope u guys understood just a little bit of what my problem is.
1000 x thx in advance
//ev00l
|
|
|
|
|
When you edit the data it is stored locally in the dataset. You then fetch the changes from the dataset and send them to the database as a bulk update. Simply move the database update part to a background worker and you should get much smoother operation. Just watch out though, if you fetch the updates and start sending them to the database you must make sure that you handle new local updates while sending the current ones.
|
|
|
|
|
thx alot for the answer. Perhaps u could explain a little more about backgroundworker (multithreading i guess?) And perhaps some good suggestions to avoid the catch of remote and local updates in the same time.
|
|
|
|
|
ev00l wrote: i am far from a proffesionel programmer
What are you going to try your hand at next? Perhaps build a bridge or dabble at brain surgery?
ev00l wrote: Perhaps u could make it update the dataset in the background?
Yes you can using a thread. Most professional novice programmers are not capable of such endeavors but I'm sure you will be fine... well at least your software can't kill anyone... umm... errr... can it?
|
|
|
|
|
Are you in a bit of a bad mood today Mike?
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: Are you in a bit of a bad mood today Mike?
No way! If you had heard me laughing when I read the OP you would've gotten a different read on my mood.
Now look what happened with ev001... "oh can you explain multi threading to me" ROTFLMA.... yeah, never saw that coming!
|
|
|
|
|
sry for asking questions dude, perhaps the guy had a link to some nice backgroundworker guide. In the future, just ignore my posts, and continue ur sad life as usual.
|
|
|
|
|
ev00l wrote: perhaps the guy had a link to some nice backgroundworker guide.
You mean like this[^]
ev00l wrote: In the future, just ignore my posts, and continue ur sad life as usual.
Thank you! Finally someone realizes that I come to CodeProject so dabbling developers can tell me what to do!
|
|
|
|
|
I actually got it to work with the backgroundworker component and a timer
|
|
|
|
|
ev00l wrote: I actually got it to work
so it probably works and might work again so ship it!
|
|
|
|
|
I wrote a program using an article from Code project as a reference in order to communicate with PIC16F877A using RS232.
I cannot receive any data from the PIC. I tried by sending many data types as, decimal, hex, ASCII eyc... but nothing worked. Plz help me with this, any help would be really appreciated.
THANK YOU
|
|
|
|
|
You want to post this at the bottom of the article- the author should respond.
Also, Hello is not a good subject title.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Hi, lacking a lot of essential information, here are just some ideas:
1.
Sending/receiving text is easier to debug than sending/receiving binary data, so if you
have a choice, start experimenting with text. There are many reasons for this: the serial
driver may react on special characters such as CR, LF, ENQ, ACK, CTRL/S, CTRL/Q, etc, which
are not present in normal text, but obviously can appear in arbitrary binary data.
2.
check connection hardware:
use a terminal emulator such as HyperTerminal to check whether anything comes in. Try a
couple of baud rates. If data is not text and/or baud rate is wrong, you probably will
get strange characters; they would prove connection is present.
3.
check transmission first: sending is much less critical than receiving, so try, if you can,
if things you send actually arrive (maybe there is a command available to toggle a LED
or so).
4.
hardware handshake
if you don't get anything, maybe the sender needs some control lines set before it feels
a need to send something; look for the RTS signal ("Request To Send"), or send a software
dataflow character (try sending a CTRL/Q).
5.
port settings
if you do get something, but it does not look right, try different port settings (baud
rate, parity, ...). Choosing "no parity" gives best chances.
6.
if HyperTerminal works, but your app does not, it still may be a port setting/handshake
problem, or a conceptual mistake in your code. Try the others first and let us know.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Like Malcolm said, you might be better off leaving a message in the discussion forum at the bottom of the article for the author.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi all,
i have some user controls on the form which fetch data from webservice and display them.
the problem is when the form loads it flickers for some time and then all the control are displayed.
Is there any standard solution for this.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Disable control painting until you fetch data from ws
Visit my blog at http://dotnetforeveryone.blogspot.com
|
|
|
|
|
If you do this you will get an ugly effect if you drag another window over your form. I think it would be better to try double buffering, or making the control threaded so that it will be able to repaint itself while loading data.
|
|
|
|
|
Hi guys,
I am having a problem in my application..the prob is that i wanna get the list
of controls on the other form...so what i have done is that
1> I have instantiate the form of which i wanna get the Control list
2> Recurse through a foreach loop and get each control and put the details in a XML file..
Now the main prob that is arising is that the controls are comin i the form in any order(ie textbox,button,textbox etc) and i want to recurse in the order of top to bottom and left to right(ie first label then textbox then again a label and then textbox and so on).
the i have implemented is
Code: ( text )
Form2 frm = new Form2();
foreach (System.Windows.Forms.Control ctr in frm.Controls)
{
.....
}
if anyone can help plz reply and for further clarification do reply....
.Net Developer
|
|
|
|
|
You're using the easy way. If you want to recurse and order it from location you have to check every control position and begin to order it.
The order of controls maintains the jerarchy (containers jerarchy) but real order is the order in whic you have inserted controls(see designer file).
Visit my blog at http://dotnetforeveryone.blogspot.com
|
|
|
|
|
il_masacratore wrote: The order of controls maintains the jerarchy (containers jerarchy)
You mean hierarchy?
Paul Marfleet
|
|
|
|
|
hey the blog for which you have created a link is in some other language then english...plz tell how to convert it in english otherwise please explain in detail as to how get the location of the controls and then add them in the xml file...Please help!!!!!!
.Net Developer
|
|
|
|
|
You cannot get them in any particular order from the controls collection. You will need to loop through the controls collection several times, finding out which control to fetch for every loop.
It should also be possible to add all the controls to a SortedList and write a custom comparer that can determine if one control should be sorted before another depending on Left and Top properties if that is what you want.
|
|
|
|
|
i dont think thats possible...as for me i am creatin an application where i want to convert the whole form presented to me into an XML file and this is dynamically so i dnt knw which controls are there and in which order i just want to fetch those controls on the form in the order in which we usually put the controls ie top to bottom and left to right..
the form may have 10controls also and 50 controls also...
.Net Developer
|
|
|
|
|
I don't see a contradiction there. You just need to define rules to determine how to sort the controls. You will need the rules anyway you turn, because there is no such sorting built in.
|
|
|
|
|
how to manage profile object on shared shared. when i try to run application, server raise permission error.
|
|
|
|