|
Just out of curiosity I downloaded the library you mentioned and it works for me. This is my small test:
info.lundin.Math.ExpressionParser exp = new info.lundin.Math.ExpressionParser();
Hashtable h = new Hashtable();
h.Add("x", "1");
h.Add("y", "1,5");
h.Add("z", "0,23");
double result = exp.Parse("x + y + z", h);
MessageBox.Show(result.ToString());
The result is 2,73 -just as expected.
EDIT:
If you want to take the expression directly from a textbox, use this code:
info.lundin.Math.ExpressionParser exp = new info.lundin.Math.ExpressionParser();
Hashtable h = new Hashtable();
double result = exp.Parse(myTextBox.Text, h);
MessageBox.Show(result.ToString());
This also works for me. However (just a guess), you might get that error because you are using incorrect decimal separator for your culture. On my machine the comma is the separator, but for you it might be the dot. Check it.
|
|
|
|
|
Thanks very mutch blackjac
But it still not work if i use dot ex. 1.4 then it takes it like 14 and if i use 1,4 coms with error
"No value associated with 1,4"
|
|
|
|
|
2,4 is not a valid decimal/floating-point-number in most cultures.
|
|
|
|
|
i use a culture en US ? in my web.aspx project.
|
|
|
|
|
Then you need a dot '.' not a comma ',' eg 2.453
|
|
|
|
|
Now it works.. thank thanks very much..
|
|
|
|
|
Burim Rama wrote: thank thanks very much..
No problem, was easy once I had all the info
|
|
|
|
|
somtimes you can use lot of time with som easy code
|
|
|
|
|
Burim Rama wrote: i use a culture en US ?
Decimals are not done with commas in the US
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
do you want to put all together on the screen? 1 + 1,3 + 1 + 7 if not
add a button "="
use:
int total;
click button "=" event (or other) inside put:
total = total + convert.toint32(textbox_x)
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hi,
I am using the MSCOMM for sending and getting the response from hardware in Desktop Embedded Application I am getting the following values in response of MSCOMM port:
Wrong Values :- 0x192,0x20ac,0x201a,0x201e,0x2026,0x2020,0x2021,0x2c6,0x2030,0x160,0x2039,0x152
0x17d,0x2018,0x2019,0x201c,0x201d,0x2022,0x2013,0x2014,0x2dc,0x2122,0x161,0x2039
0x153,0x17e,0x178
Instead the values should the values coming from the hardware are
Correct Values :-
0x80,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8e,0x91,0x92
0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9e,0x9f
But in Dot Net the Values given above are coming in the Input of MSCOMM.When I use the above values in my code as :-
char chars = Convert.ToChar(response)
MyByte = Convert.ToByte(chars)
where response = 0x192
The 2nd line of getting MyByte is skipped by Dot Net for above values
Can anybody tell why is this happening
|
|
|
|
|
Hi,
From your list of expected values you appear to want 8 bit byte values but are receiving 16 bit chars. I've never used the MSCOMM component but surely a good start would be to set the input mode to binary.
com.InputMode = MSCommLib.InputModeConstants.comInputModeBinary;
At the moment it must be set to comInputModeText
Alan.
This link is useful for the basics
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=320[^]
|
|
|
|
|
You want to cast, not convert.
You serial port settings could also be incorrect.
|
|
|
|
|
You asked this question previously and it was suggested to you to to alter the way you're casting the incoming values, yet here is the same code. Why are you using the MSCOMM control in C#? Shouldn't you be using the SerialPort class? Anyway, the runtime doesn't SKIP the code, it throws an OverflowException, did you actually attach the debugger and step the code?
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
is it possible to invisible 1 column in datalist?
|
|
|
|
|
DataList1.Items[0].Visible = false;
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hey Guys Need Help
I created a Console Application to send out mails. The method i used is adding reference of Using System.Web.mail
MailMessage mail = new MailMessage();
mail.To = "xxx@xxx.com";
mail.From = "xxx@xxxe.com";
mail.Cc = "";
mail.Subject = "Testing Console";
mail.BodyFormat = MailFormat.Html;
mail.Body = "Testing";
SmtpMail.SmtpServer = "xx.x.xx.xx";
SmtpMail.Send(mail);
But I gotten this error saying "The transport failed to connect to the server."
Then I used The System.Net.Mail
MailMessage message = new MailMessage();
message.From = new MailAddress("xxx@xxx.com");
message.To.Add(new MailAddress("xxx@xxx.com"));
message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));
message.Subject = "This is my subject";
message.Body = "This is the content";
SmtpClient client = new SmtpClient("xx.x.xx.xx");
client.Send(message);
But I gotten this error saying "Failure sending mail.."
I am running out of ideas. Any solution or advise
Thanks A million
KaKaShi HaTaKe
|
|
|
|
|
HatakeKaKaShi wrote: Then I used The System.Net.Mail
This is the preferred way of sending mails from .Net 2.0 onwards.
HatakeKaKaShi wrote: But I gotten this error saying "Failure sending mail.."
Your priece of code looks ok.
What I can think of is that your SMTP server is either not accepting the mail or it is not there at all.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
hahahaha You are right bro....... I am all stress up over wrong IP
Anyway Thanks Man
KaKaShi HaTaKe
|
|
|
|
|
Hi,
I created a transparent Richtextbox control whose background color is transparent.
Since, .NET does not support transparent background color of RichTextbox we need to use the CreateParams of the Windows API.
I used the code below in order to make the RichTextBox transparent:
(reference: http://www.dotnetjunkies.com/WebLog/johnwood/archive/2006/07/04/transparent_richtextbox.aspx)
public class RichEdit50 : RichTextBox
{
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
static extern IntPtr LoadLibrary(string lpFileName);
protected override CreateParams CreateParams
{
get
{
CreateParams prams = base.CreateParams;
if (LoadLibrary("msftedit.dll")!=IntPtr.Zero)
{
prams.ExStyle |= 0x020; // transparent
prams.ClassName = "RICHEDIT50W";
}
return prams;
}
}
}
Actually I have a usercontrol, over which I placed this RichTextbox .
I have made the Richtextbox transparent by using the RichEdit50 class.
Now, i set the background color of the user control to transparent. But, the problem is that whenever i put some text on the Richtextbox control which is transparent, the text disappears if i hover the mouse anywhere on the screen.I guess, since the control now is set to Transparent background, everything including the text on the control is disappearing.
I am not sure how to retain the text on the Richtextbox.
Any help will be appreciated.
Thanks and Regards,
Deb
|
|
|
|
|
If you do something unsupported, expect issues, else they would have made it available. Personally, I would not supply a custom class name as you have done.
|
|
|
|
|
Hi,
By using the above code which I have mentioned I am able to get the Transparency od the RichTextbox control, but the problem is that the text is not somehow being able to retain on the control.
The text on the Richtextbox suddenly gets disappear when i hover the mouse on the screen.
Can someone help me out on this problem.
Thanks and Regards,
Deb
|
|
|
|
|
Hi,
I am using the following code to get the installed printers on the local machine.
During the loop, when it gets to one of the printers, it throws an error which is invalid parameter. I can not figure out what is wrong.
Error happens on the foreach line.
I do not see any difference between the printer that seems to throw the error and all the other printers.
Any thoughts please?
This is the code:
using System.Management;
...
string strServer = "\\\\" + txtServerName.Text.Trim();
ManagementScope myScope = new ManagementScope(strServer + "\\root\\cimv2");
SelectQuery oQuery = new SelectQuery("SELECT * FROM WIN32_Printer");
ManagementObjectSearcher oResults = new ManagementObjectSearcher(myScope, oQuery);
//Iterate through printers...
foreach (ManagementObject oItem in oResults.Get())
{
string strPrinterName = oItem.Properties["DeviceID"].Value.ToString();
}
|
|
|
|
|
I am developing a rent a car software. The customer is limited to 150mile daily and he should pay US35 for every 10miles extra.
How can I calculate that on the day customer returns the vehicle?
|
|
|
|
|