|
I think you mean in stringToPrint is path to file, but it isn't. In stringToPrint is text converted from StringBuilder variable and contains more lines.
I just solve problem with the suggest from second reply.
Thanks for your effort.
|
|
|
|
|
I was just providing a suggestion as to prevent needless overhead for reading the string.
Grats on solving the problem.
|
|
|
|
|
try a loop like this :
Do While strReader.Peek() >= 0
Console.WriteLine(strReader.ReadLine())
Loop
|
|
|
|
|
|
Hey guys,
I'm facing a small problem. I have a desktop app made in C# and it workss perfectly fine on my screen resolution but when i deploy on my client's OS all the controls look wierd due to the higher/lower resolution. What can I do about this. I have heard of a library called Klib or something but its paid -
Is there a free alternative. I dont want the controls on my form getting resized, just the spacing would be affected. Any way around this?
Thanks in advance!
|
|
|
|
|
If it's just the spacing you want affecting, check out the anchor property on your form.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello,
I have just finished a card game on C#. I faced some problems while doing the setup.
1. The "Images" folder that i used to take cards pictures from is no more there after doing the setup so when i run the .exe it gives me an exception error.
2. How can i change the icon for the game from the setup ?
3. how can i create a shortcut for the .exe on the desktop from the setup ?
Thanks in Advance.
Jad
|
|
|
|
|
hey,
I have a very simple problem, which I fear has a very complicated solution.
I have a form containing a treeview, consisting of several thousand nodes, and a textbox. I want the treeview to filter it's contents based on a filter string in the textbox. Here comes the tricky part: I want the treeview filter process to run simultaneously with the normal gui thread, such that the user can see the filtering of the treeview happen as he fills the textbox. Due to the large number of nodes in the treeview the call "treeView1.Nodes.Add(..);" which adds the new nodes to the treeview is very slow, and this will effect the responsiveness of the textbox where the user will experience delays as he fills the textbox.
Normally I would put the treeview filtering code in a separate thread, however .NET doesn't allow gui code that updates gui components to run in separate threads, so I'm kind of stuck.
Any ideas?
regards
Jimmy
|
|
|
|
|
You should create a delegate that is modying the form and invoke it in the treeview filtering thread like this m_form.invoke(delegate)
|
|
|
|
|
thank you for the fast response!
Calling Invoke doesn't solve the problem I think, when I call Invoke the process of updating the treeview is transfered to the main gui thread, and thus the delay still happens.
|
|
|
|
|
You need to use Control.Invoke or Control.BeginInvoke to update the UI
from a non-UI thread
|
|
|
|
|
Hi,
does anyone know an easy way to convert e.Graphics to an image in the paint event of a form or panel?
thx
Kurt
|
|
|
|
|
okay,
doesn't seem to be that hard.
A Control has a .DrawTobitmap() method.
greetz...
Kurt
|
|
|
|
|
what kind of reg exp to be specified to allow values upto 2 decimal places?(say .25 or 22.22)
vijeta
|
|
|
|
|
I assume that you also want to allow numbers without decimals?
This allows 1 or more digits, or zero or more digits followed by a period and one or two digits:
"(\d+)|(\d*\.\d{1,2})"
---
b { font-weight: normal; }
|
|
|
|
|
I have a Qty field in the grid. To validate this field i have used the code given at the end.
I tried various regular expressions representing decimal value, but none is working.
For all the cases, for '.' e.handled is set true. So, i am not able to get '.' as input. Can anyone help me:
private void tb_KeyPress(object sender, KeyPressEventArgs e)
{
string regexstring = @"(\d+)|(\d*\.\d{1,2})";
Regex reg = new Regex(regexstring);
if (reg.IsMatch(Convert.ToString(e.KeyChar)))
{
e.Handled = false;
}
else
{
e.Handled = true;
}
}
|
|
|
|
|
What is the purpose of assigning the upper/lower threashold values in order to find specified words in a given txt by Pseudonym67 ? How does it apply to the Fuzzy operations?
What will be the effect of not using the threashold values in the Fuzzy Word Example by Pseudonym67?
jinendra
-- modified at 7:28 Saturday 28th October, 2006
Jinendra
|
|
|
|
|
Hi,
I've got to import a collection of text files into a database, the collection being anywhere between 3 and 20 files in size.
A typical collection would look like
1 x AD?????????.txt
1 x LB?????????.txt
? x PL?????????.txt
There can be anywhere between 1 and 20 PL files at any one time.
I'm wondering on what the best way is to deal with the files with multiple versions, ie the PL files. Is it better to create a new file and append all of the text from the PL files into it before import? If so, how? I know there is a FileMode.Create method but am unsure as how to use it. Any tips on this or suggestions on a better approach would be greatly welcomed.
Thanks a lot
Scott
|
|
|
|
|
Are you creating these files, or just importing them into the database?
If it's an import, just traverse through the directory and get the files that match your file mask, and import them one at a time. It seems like a longer process to concatenate the files. In the case of an error, you will know exactly which file caused the exception when they are imported separately.
|
|
|
|
|
Hello,
I have a server ( run under NT\SYSTEM because launch by windows service )
This server look after inserting usb key.
I have on the same computer, a client ( run under domain\login ) insert an usb key.
Only the client can eject the usb key
The serveur cannot ( message exception is : RemoteMachineNotAvailable )
How server can execute fonction eject ( CM_Request_Device_Eject ) with the identity of the user ?
thanks
PLEASE HELP ME !!!!
Vincent
|
|
|
|
|
What is the fastest way to find a string in .NET? I have a set of strings and I want to know whether a certain string exists in the set or not. Time is critial for this operation so I am looking for the fastest way.
* There will be no duplicates in the set.
* The order of the strings is unimportant.
* The number of strings in the set is likely to range from a couple to a couple of hundred. Typically, I expect the set to contain about a dozen or so strings in most situations.
|
|
|
|
|
Put the strings in a Hashtable.
You probably won't notice much of a time difference when you have as few as a dozen strings, but for a couple of hundred strings it's a lot faster.
---
b { font-weight: normal; }
|
|
|
|
|
|
I would also consider using a generic list of strings. I've been using List<> a lot lately, and it is very very nice.
What I would do, is add your strings to the list and then sort it.
Once it's sorted, use the List<>.BinarySearch to find the string. It really is fast - I've run tests with a 100,000 complex objects where it takes less than a millisecond to find a particular item. I know that this is not a particularly scientific test, but it does indicate that this is a really fast method.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: Once it's sorted, use the List<>.BinarySearch to find the string. It really is fast - I've run tests with a 100,000 complex objects where it takes less than a millisecond to find a particular item. I know that this is not a particularly scientific test, but it does indicate that this is a really fast method.
A binary search in 100,000 strings should need no more than 16 or 17 comparisons, so I would expect it to take far less than a millisecond.
Yes, BinarySearch is very fast, but it still uses string comparison. A hash table compares the hash codes of the string, which are integers, so the comparisons are a lot faster.
---
b { font-weight: normal; }
|
|
|
|