|
Wogboiii wrote: Can you use threading without a static method?
I don't see any static methods other than main in the example code in the documentation for BackgroundWorker[^], do you?
|
|
|
|
|
Or in the BGW's code[^].
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Sure...
The static keyword has nothing to do with how the code is executed, but only with where it lives (instance or type). Static/not static is simply irrelevant when it comes to different threads.
In the end, it's all bytes that run through the processor, no matter where they come from...
Regards
Thomas
www.thomas-weller.de
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. Programmer - an organism that turns coffee into software.
|
|
|
|
|
I think the original poster saw an example using a static method to start a new thread and thought it was a requisite.
|
|
|
|
|
Hi experts
i am using visual studio 2005 and sql server 2005
i am working on winform.when i want to fill the datagrid view simultaneous
show the .gif picture that show loading of grid.
but when i run it gif is not working. it run work when the grid fill Completely.then how i can fix this problem so that both grid and .gif work
simultaneous.
Thank u
Dinesh
|
|
|
|
|
Do you mean "show the .gif picture that show loading of grid." use the .gif like a progress bar, or similar to the images shown during a file copy operation?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
look at the BackgroungWorker[^] component
What the issue is is that your form is not being updated until the load code has completed. You could try Form.Refresh(); every now and then during your loading. But I would strongly suggest you go for a background worker
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
hi....
I have a code in C# by which i can write string data in Mifare 1k card.
But the problem arises when i tried to write IMAGE file .
Can someone tell me how to use byte array so that i can do my task?
thanx...
Anand (delhi)
|
|
|
|
|
I don't even want to know what an Mifar 1k card is, but, the card as such is such not supposed to know if you're writing text or anything else into it. So, just write the contents of the image in binary format into it.
Also, try to be more specific in the future.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
I need some suggestions on what should I learn
Till now I know about: arrays, lists, queue (FIFO),(LIFO), sql databases...
what should I learn next.. The problem is that I dont know how to connect my program to the internet and get information from there etc.
any tutorial on how to do this thing?
|
|
|
|
|
Try searching the articles for "webrequest" and that might get you started.
|
|
|
|
|
Actually, It would be better to look at the System.Net.WebRequest classes instead
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
j4ck1we wrote: queue (FIFO),(LIFO)
I believe stack is the word you are looking for for (LIFO)
j4ck1we wrote: what should I learn next..
It depends on what you want to do...
If you are looking at working with data across a network then there is the System.Net[^] classes that may be of interest. Thou first I would suggest taking a good look at the
System.IO[^] classes and get a good understanding of how file streams work.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Well I'm thinking of building a small app that get some info from a page (search for links in it and clicking etc.)
What things could help me do this?
|
|
|
|
|
I'm writing a small program to help me sort my thousands of images.
But whenever I want to rename a file, I get the following error:
The process cannot access the file because it is being used by another process.
I use the following code for it
private void B_Rename_Click(object sender, EventArgs e)
{
L_Status.Text = "";
File.Move(Path.GetFullPath(images[current]), Path.GetFullPath(TB_New_Name.Text));
L_Status.Text = "image '" + images[current] + "." + extension +
"'\r\nhas been renamed to\r\n'" +
TB_New_Name.Text + "." + extension + "'";
images[current] = TB_New_Name.Text;
} images is the string list holding the file names, current is the current index and extension is the file extension.
My other problem is the number formatting.
The images should be named with numbers, but since windows sorting is strictly text based, 2 would come after 10.
So, I tried the string.Forma t method to name the images 001, 002, etc., but it doesn't quite work.
public F_Main()
{
InitializeComponent();
files = Directory.GetFiles(dir);
this.Text = string.Format("{0:00}", 1);
this.Text += " - ";
this.Text = string.Format("{0:00}", 12);
this.Text += " - ";
this.Text += string.Format("{0:00}", 120);
} I thought this code would display "001 - 012 - 120" in the form title, but instead it onlydisplays "12 - 120"
Thanks.
|
|
|
|
|
Hi,
1. there are a couple of ways to keep a file "in use by another process", and you should, for once, not take "another process" literally. Here are some:
- another process has opened the very same file
- for text files that other process could be an automatic indexer
- for several extensions that other process could be an antivirus checking a newly created file
- MOST LIKELY IN YOUR CASE: an image loaded with Image.FromFile() remains locked as long as the image lives.
2. numeric format "D3" would always use at least 3 characters, filling with leading zeroes.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Check if the "image" file you want to move is already opened from somewhere else.
The second problem is :
See this line :
this.Text = string.Format("{0:00}", 12);
it has to be
this.Text += string.Format("{0:00}", 12);
|
|
|
|
|
I think your missing the point of the question. I believe the OP was trying to demonstrate that the number formatting did not include the desired prefix of zeros.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
The error usually occurs when you have a reference to the image still active. How are you loading the 'images' list can you show the code for that please.
with regards to the fomatting then try using the int.ToString() method...
int i = 12;
string s = i.ToString("000");
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
In addition to Luc's points, for 2.
public F_Main()
{
InitializeComponent();
files = Directory.GetFiles(dir);
this.Text = string.Format("{0:D3} - {1:D3} - {2:D3}", 1, 12, 120);
}
seems neater and easier to read to me.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute wrote: this.Text = string.Format("{0:D3} - {1:D3} - {2:D3}", 1, 12, 120);
Problem with that is it will only work for a fixed number of files, which anything above 1 seems like too much work for me
...Thou given the OP's example it would produce what he was showing. My assumption is that each file with be appended with a number that increments with each file
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: it will only work for a fixed number of files,
Whilst that is true, I was simply implementing the users own logic, in what I thought was a better way. You are absolutely correct if there were likely to be an unknown number of files.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
that's why I edited my post as I can see you are just providing a solution based on the OP's example
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks.
For the formatting "D3" works the way I want.
Though, the main problem is still the renaming.
I changed the code for displaying the picture to:
Bitmap picture = new Bitmap(800, 600);
picture = new Bitmap(images[0]);
PB_Image.Image = new Bitmap(picture);
picture.Dispose();
TB_Old_Name.Text = Path.GetFileNameWithoutExtension(images[0]); And this is the code I use for renaming:
L_Status.Text = "";
File.Move(Path.GetFullPath(images[current]), Path.GetFullPath(TB_New_Name.Text));
L_Status.Text = "image '" + images[current] + "." + extension + "'\r\nhas been renamed to\r\n'"
+TB_New_Name.Text + "." + extension + "'";
images[current] = TB_New_Name.Text; But now the program simply deletes the image.
I tested it and the image that should have been renamed simply disappeared.
|
|
|
|
|
Good day to all off the codeproject members.
is there anyone who has some sample c# code that can read from a mifare rfid reader (through a serial comm port)
It is a PCR310 RFID reader with GNET plus protocol
With kind regards
Gerrit
|
|
|
|