|
Add a using System.Text.RegularExpressions; to the code, or specify the full namespace of the class as System.Text.RegularExpressions.Regex .
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You can split all at once since the parameter for Split is an array. For example:
string [] split = words.Split(new Char [] {'+', '-', '*', '/'});
or you can use Regex as Guffa suggested.
However I thought that you don't want split with all operations at once since then you may have a problem in knowing what were the original operations.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
hi...thanks alot
but i really have problem in determining what the operation order was
also..i tried the codeline you wrote but it gives a compiler erorr on the words:
Error 1 The name 'words' does not exist in the current context
i appraciate your help
while(1)
System.out.println("I love Palestine ");
|
|
|
|
|
For the compiler error: the words was only a variable name. In your case use the variable where you have the original string you want to split.
And then the logic (since this seems to be a homework assignment I won't go to full blown solution). One (brute force) way to handle this could be:
- create a class that holds information about the input string, number and operation (three separate properties)
- create a generic list for this type where you will store individual 'elements'
- break the operations one by one into parts and add them to the list to the place where you parsed them.
Something like following (let's say the class name is Operation:
First you have only one Operation instance in the list, which has three properties
1: text: 22+35-76+28*5, number: empty, operation: empty
if you split the text using plus, you could then have three instances on the list
1: text: empty, number: 22 operation: +
2: text: 35-76, number: empty, operation: +
3: text: 28*5, number: empty, operation: empty
then if you split using minus you could have four instances (note the order)
1: text: empty, number: 22 operation: +
2: text: empty, number: 35, operation: -
3: text: empty, number: 76, operation: +
4: text: 28*5, number: empty, operation: empty
and so on.
This won't entirely solve the issue you have, but perhaps gets you forward.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I have the following case statement where I am looking for a enter key being pushed to be in the suffix. I need this to be a enter but I can not seem to figure out how to add the char(13) as I can not make it into a string and fit into the const setting. Can someone help me with this?
<code>
string keyAscii = e.KeyChar.ToString();
const string Prefix = "|~";
const string Sufix = "";
switch(keyAscii)
{
case Prefix:
break;
case Sufix:
break;
default:
break;
}
</code>
|
|
|
|
|
|
|
Hi
i want to insert datatable object to database, i know which can do this by SqlDataAdapter.Update() or TableAdapter.Update() methods, but my question is that is this work correctly for enterprise systems ?
have it high performance ?
what's best approach for this aim ?
(beacuse currently, i am develping a large application (enterprise system) for at least 800 concurrent users).
any idea would be appreciated
thanks
|
|
|
|
|
It sounds like you are using the MS data wizard objects. You should build a data access layer (DAL) and use dataset.fill, datareader and datatable. You should also be doing the CRUD via stored procedures.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All,
In both my last job and my current job we have had applications that sit on (very) busy PC's which typically run anywhere between 10-20 spreadsheets in Excel, several internet explorers, market data systems etc. In both cases our C# application always runs out of handles and stops working (throws exceptions etc) with problems in the call to CreateHandle. Clearly whats happening is we are hitting the internal win32 handle limits. I know of a registry entry that I can change that will increase the limit but this at best still only stalls the problem - not fixes it. Others among you must have seen this problem so what did you do about it?
Cheers,
E.
|
|
|
|
|
I had many applications which works on busy systems and working without any issues. Looks like you have some design issues. Hard to help without getting more information on what you are trying to do.
|
|
|
|
|
Hello community,
I'm writing a programm which shell set other windows to the foreground. So I would like to know how I can check which process a window has, that I select via a mouse click. Is this possible with a API function?
Best regards
MyPiano
|
|
|
|
|
Hy,
Try the WindowFromPoint & GetWindowThreadProcessId APIs
|
|
|
|
|
Okay, thank you very much.
|
|
|
|
|
Hi,
1) Can anybody tell me how can generate the connection string to my SQL Database from the solution explorer in VisualStudio2008.
2) Also can anybody tell me how i can resolve his error in my SQL;I tried the settings from Surface Area Config: but it didn't help
Error "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
Many Thanks,
modified on Sunday, October 19, 2008 12:32 PM
|
|
|
|
|
new2pgrmg wrote: Can anybody tell me how can generate the connection string to my SQL Database from the solution explorer in VisualStudio2008.
The solution explorer displays the files in your solution. It can not be used to create a connection string.
new2pgrmg wrote: Also can anybody tell me how i can resolve his error in my SQL;I tried the settings from Surface Area Config: but it didn't help
What error?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi Guffa;
Thanks for trying to help.
For my first question i found the soln from server explorer.
"http://kb.seekdotnet.com/ViewArticle/119data.aspx"
For the second question this is my error message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
Thanks for the help
|
|
|
|
|
The error message simply means that no SQL Server is responding on the server address that you specified in the connection string.
Have you checked the address in the connection string?
If you have a firewall between the application server and the database server, you need to make sure that the port used by SQL Server is forwarded to the database server.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi Guffa,
Thanks for the help.
I resolved the issue.There was some issue with the connection string ;after resolving it my connection is working fine.The take away for me from here is if there is any issue with the connection string this error will happen.
Thanks Again for your replies.....
Keep up the spirit....
|
|
|
|
|
I m doing a customized crystal report having 30 feilds.based upon the font size of the feild and text object incresing an decresing the with . i know tht all the monospaced courier new having same width.so if i knw how many pixcel of each character occupied of each and every fon size from 6-12,it will easier to me .what i thinking if there 5 charcter in a text object ,so i can calculate each character*number of pixel=total pixel.based upon that tht i can set width of the text object through coding.same applicable for field object also.but i am new to crystal report programming .i m not getting all this .can anybody help me how to find of number of pixel in each character in diff font size and how to set the width of that text and field object through coding .I need urgebt help and plz help me by giving sample code for VS 2005 in c#.net.thanks and waiting 4 early reply.
|
|
|
|
|
I don't know anything about Crystal Reports, but allow me to share some of my knowledge about this forum:
0. If your post includes 'urgent', or in your case 'urgebt' you are actually less likely to get an answer (in fact, it's more likely you'll get flamed...). You should remember everyone here helps because they want to, so they might be a bit slow about it.
1. A spell-checked post, using full English words instead of this 'plz' rubbish, with proper capitalisation and spacing is far easier to read, and so more likely to get an answer (I, for example, run all my posts through MS Word's spellchecker before posting).
2. It is generally considered rude to double-post. It definitely won't get your problem answered any faster. The better thing to do would have been to alter your original post with the new info.
|
|
|
|
|
sure.I will definately keep into mind next time and thanks for ur advice.
|
|
|
|
|
how to change font size of the formula fields of crystal report dynamically ?????its urgent ....
|
|
|
|
|
First, the code that i´m using:
HttpWebRequest hRequest = ((HttpWebRequest)WebRequest.Create(url));
hRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3";
HttpWebResponse resp = (HttpWebResponse)hRequest.GetResponse();
StreamReader reader = new StreamReader(resp.GetResponseStream());
string res = reader.ReadToEnd().ToString();
reader.Close();
textBox1.Text = res;
The problem is when i see html source into the textbox it appears bad formatted, dont know if each line of a texbox has a limit of characters and this is why it jumps to another line or what happens.
I set the wordwrap property of the textbox to false and added both scrolls bars, but it still bad formatted.
Can someone help me?
Thanks in advance.
|
|
|
|
|
Nothing is wrong with the TextBox. It's just the string you're getting get from the response is not formatted, the textbox outputs it as it is. Most, if not all, compilers and interpreters don't generate formatted response. If you're calling a static webpage, it's just the way it is.
Eslam Afifi
|
|
|
|