|
I'm not sure if this is what you're after but if you have stored the whole Word document in a varbinary field, save the contents to a file with doc extension. After that open it simply by executing the file in a shell (with Process.Start method) or use Word interop if you want to add it to an existing document.
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Mika,
I am sorry, I wasted your time. I have resolved my issue.
Thanks,
dunloe
|
|
|
|
|
No problem at all. You don't have to be sorry if your problem got solved.
If you feel afterwards that your post or my reply was somehow 'bad' or that something should have been figured out earlier, it's only part of the learning process and it goes both ways.
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I am an existentialist that happens to be a programmer. There is no right or wrong. In our realm just syntax, and the sharing of that syntax.
All the best,
dunloe
|
|
|
|
|
hi...i wrote this code to read the input of textbox, and i wanna to classify each input to compute the given expression i want to store each operand in an index of arrayList ... as example:
suppose the input is : 22+99*7
then when i display the contents of the arrayKist results should be :
22
+
99
*
this is my Code please i realyy need help i stuck here:
private void equal_Click(object sender, EventArgs e)
{
ArrayList equation = new ArrayList();
string input = textInput.Text;
char[] Buffer = input.ToCharArray();
string tempString="";
try
{
FileStream historyFile = new FileStream("History.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(historyFile);
DateTime log = new DateTime();
sw.WriteLine(input + ": @ time " + log.TimeOfDay + "@ date " + log.Date);
sw.Close();
historyFile.Close();
}
catch( FileNotFoundException l)
{
MessageBox.Show("Logs File Not Found !!","Error Message");
FileStream exeptionFile = new FileStream("Errors.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(exeptionFile);
sw.WriteLine(l.ToString ());
sw.Close();
exeptionFile.Close();
}
for (int i = 0; i < Buffer.Length; i++)
{
if (char.IsDigit(Buffer[i]))
{
tempString += Buffer[i];
for (int j = i + 1; j < Buffer.Length; j++)
{
if(char.IsDigit (Buffer[j]))
tempString += Buffer[j];
}
}
else if (char.IsLetter (Buffer[i]))
{
tempString += Buffer[i];
for (int j = i + 1; j < Buffer.Length; j++)
{
if (char.IsLetter(Buffer[j]))
tempString += Buffer[j];
}
}
else if (char.IsSymbol (Buffer[i]))
{
tempString += Buffer[i];
for (int j = i + 1; j < Buffer.Length; j++)
{
if (char.IsSymbol(Buffer[j]))
tempString += Buffer[j];
}
}
equation.Add(tempString);
}
for (int t=0; t<equation.Count ;t++)
MessageBox.Show(equation[t].ToString());
}
while(1)
System.out.println("I love Palestine ");
|
|
|
|
|
You didn't quite indicate your exact problem.
However, perhaps you could use String.Split (for known operators) to find each operand and then test that operand is valid for example using Decimal.TryParse .
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
thanks mika...
my exact problem is that i cant get the operands exactly as extra operands are stored such the instead of storin just the 22 it stores also 2 and insted of 222 it stores two other operands 22 and 2 ... have i explained well??!!
there isnt just one operand to split around its all operands(mathmatical operations)...
what do think now?
thnx in advance..
while(1)
System.out.println("I love Palestine ");
|
|
|
|
|
I can usually reduce posted code quite a bit, but this time it really got a lot smaller.
string[] equation = Regex.Split(textInput.Text, "([+-*/])");
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
ok gofa...thanks
but it gives compiler error on the word: Regex
Error 1 The name 'Regex' does not exist in the current context
while(1)
System.out.println("I love Palestine ");
|
|
|
|
|
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.
|
|
|
|