|
Hi,
I would suggest you consider a ListBox instead of a TextBox;
it avoids having to concatenate all the strings and will result in much better
performance.
|
|
|
|
|
I would suggest you use arraylist achieve as mentioned by others, for more information on arraylist visit....
http://msdn2.microsoft.com/en-us/library/system.collections.arraylist(VS.71).aspx
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
http://jaiprakash.blog.com/
|
|
|
|
|
In the code below:
string temp = "http://www.com:8080/";
string pattern = @"^(?<protocol>\w+)://[^/]+?(?<port>:\d+)?/";
Regex r = new Regex(pattern, RegexOptions.Multiline);
MessageBox.Show(r.Match(temp).Result("${prot}${port}"));
I wonder what [^/]+? means and how it matches the temp string, while if I omit ? in [^/]+ it wouldn't give me the correct result. I have read something about lazy plus which is +? but it rather confused me . Does anybody have any idea about this? Or any useful reference about regular expressions? The documentations in MSDN or other places are not sufficient at all.
Thanks in advance
|
|
|
|
|
[^/] is a set that matches any character but /.
+ is the same as {1,}, i.e. repeats one or more times.
? makes the match non-greedy, i.e. it will match as few characters as possible.
If the pattern was greedy, it would match all characters up to the next slash. That means that it would also match all of the digits in the port number except the last one, as that last digit is the minimum needed for the rest of the pattern to match.
---
single minded; short sighted; long gone;
|
|
|
|
|
string temp = "http://www.com:8080/";
string pattern = @"^(?<protocol>\w+)://[^/]+?(?<port>:\d+)?/";
Well as you said, the part [^/]+ could be greedy and consume "www.com:8080" but in the next part we have a colon that forces us to match it with the : in the string. So I think neither of question marks in [^/]+? and (?<port>:\d+)? did their missions! I mean in this case, the pattern had to split the rest of the string to two exact parts. No other permutations could be thought of. The spiltted parts are "www.com" and ":8080/". So in fact, the pattern @"^(?<protocol>\w+)://[^/]+(?<port>:\d+)/" would have a same result for the temp string, right?
|
|
|
|
|
hamidkhan wrote: but in the next part we have a colon that forces us to match it with the : in the string.
No, you don't. The colon is the part of "(?:" which starts a non-matching group.
---
single minded; short sighted; long gone;
|
|
|
|
|
I didn't get you. Would you please explain the meaning of the part below:
(?:\d+)?
What strings would this part match?
|
|
|
|
|
The pattern inside the non-matching group would match one ore more digits, and the ? quantifier is the same as {0,1} making the match optional. So, it will match zero or more digits.
The pattern \d* will do exactly the same.
---
single minded; short sighted; long gone;
|
|
|
|
|
(?:\d+)?
The last ? makes the whole group optional, but im confused with the first ? in the group. What does it mean when the question mark comes right after the ( sign?
|
|
|
|
|
Hi!
I'm using treeview to explore pc but there is a problem.
it's very difficult to analyze drives types,folder types file types etc. and set their own icons.
But some programs are using default icons. How Can I use windows default ones?
|
|
|
|
|
Search this site for Windows Explorer TreeView. A number of people have already attempted and completed what you're trying to do.
|
|
|
|
|
Hello ! I had to do a Dictionary. So i began choosing how to keep the words.
1) >>>>>>>>>>>>>>>>Data Type <<<<<<<<<<<<<<<<<<<<
The problem is that i have a lot of same words, but with different translations.
The customer wants the words to be kept as they were given me.
Sorted lists does not support the same keys.
ArrayList is the best structure to keep the words, but it is working wery long (to load about 20000 words).
2) >>>>>>>>>>>>>>>>>>>>>Keeping on disk <<<<<<<<<<<<<<
I keep the words on disk using serialization (SOAP). Was i write?
I checked, it was 5 times slower than StreamWrite/Read, but i don't have to worry about the length of my word and translation (+some comments).
Should i left how it is, or use something else (+databases)
Thanks for your attention.
One nation - underground
|
|
|
|
|
First question:
To solve your problem with of having the same word with multiple translations, the Dictionary key would be your "word" and the Dictionary value would be an ArrayList to store your translations of the corresponding key "word".
Second question:
If serialization is too slow, storage of your data in a database would be your best bet.
Geo
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks.
I'm beginner in databases, what can you advise me to use or mayby read about it ?
One nation - underground
|
|
|
|
|
Hi,
Is there a simple way to change a font within a line of text sent to a printer.
Using DrawString you can change font from line to line. OR if I use multple DrawString calls and precisely line up the text, I can change the font from word to word, but that is very tedious.
For example. The brown (fox) jumped over the (fence).
Where (fox) and (fence) are different font from the rest of the the line.
|
|
|
|
|
That's precisely what you have to do. DrawString will only work with a single font.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Then perhaps is there a different function that I should be using? Using DrawString to print a static or semi-static form is OK, but if the text is fluid, that presents some issues.
|
|
|
|
|
There is no other function. I know it's tedious, but it's all you've got to use.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I have a question about the XmlSerializer.
Creating one seems to be quite an expensive process, so i'd like to re-use the ones i generate, however, they do not seem to be threadsafe, and do not implement the .Clone() method.
Is there any option on how to create them quickly?
Cheers
Tris
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
They aren't thread safe. However, you may be able to re-use the one's you've got. If you're hitting thread problems, why not just do some thread synchronization using the lock keyword to coordinate access to the XmlSerializer.
|
|
|
|
|
Hello forum, I have a problem regarding the playing of some sound file contineously i.e without stoping,on word document.
I want to add a sound file which till the display of page contineously play that file.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
Hello forum plz help me in finding out how to insert the bullet to word document through the c# code.
What i tried is using of function "myWordApp.Selection.Range.ListFormat.ApplyBulletDefaultOld();"
but problem is this that it inserted the bullet symbol of round circle, but exacly what i need is "-" this in place of that round circle.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
Don't Repost.
Regards,
Satips.
|
|
|
|
|
i have created windows application in .net 2005
then i have created setup Project for that application
i want create setup project with .net Frame work
when the user start installing the setup it should verify
wether the (needed frame work for that application ) is availeable in the system, if not it should install the framework first. then my application.
how to do this, is it possible ?
any ides or refrences ?
thank u
|
|
|
|
|
I always write a C++ app to do this, to install the framework, and run my MSI.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|