|
hi,
i want to make a program that draw equations.
the first thing needed is to evaluate the expression.
i used the stack to make infix to postfix conversion, but the problem here is in
the priority how can i implement the priority with out forcing the user to write every
operation between brackets ???????
any help please
thanx in advance
|
|
|
|
|
It's pretty simple actually, create an operator stack and push operators into them depending on priority. The algorithm looks like
For each element in the expression
1. If current element in expression is a number, print it out.
2. If current element in expression is an operator
a. If stack is empty, push operator into stack.
b. else, if current operator has greater precedence than operator at the top of the stack, push the current operator also into the stack.
c. else, pop operator at the top of the stack and print it
Print out contents of the stack.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thnx for ur help ,i will try this
|
|
|
|
|
You ca also create a block of C# code with a static function that returns the value of the expression, such as 'return (12 * 25 + System.Math.Sin(System.Math.PI));', and compile it on-the-fly in a memory assembly, then call the method and obtain the result. Try this article:
DotNetCompiler
It is in VB.NET, but i'm sure you won't have problems...
|
|
|
|
|
Hello All,
I have added a bool check column to Datagrid.but i dont know how would i come to know that whether that checkbox is selected or not because depending on that checkbox value i have to change value in another column?
|
|
|
|
|
Hi amrutajoshi,
Probably this may help you
foreach(DataGridItem childItem in myGrid.Items)
{
CheckBox myBox = (CheckBox) childItem.FindControl("MSChecked");
if(myBox != null && myBox.checked)
{
Response.Write("Checked");
}
}
Srinivas
|
|
|
|
|
Well i dont know if the datagrid is in Web or Forms ?.
But if it is in Web do you want it clientside or serverside ?.
If Serverside its very simple
your CheckBox has a OnChangedEvent create a method and call it from there
asp:CheckBox OnCheckedChanged="doWork" id="myCheckBox" runat="server">
|
|
|
|
|
I'm doing some interop and passing a structure to managed code via an IntPtr.
I convert the structure to the IntPtr as follows, in a mixed-mode C++ program, which then passes it to the C# program:
System::IntPtr func(Event &e)<br />
{<br />
return __nogc new System::IntPtr(&e);<br />
}
I'm not too confident about my mixed-mode C++ skills, but I think that's right... right?
However, the data I get back from PtrToStructure gives me complete gibberish. It's not a member alignment problem either, because the data is supposed to be mostly nulls but I get numbers in the millions (Event contains mostly pointers to other structures).
What am I doing wrong?
|
|
|
|
|
Ok, I solved it.
In case anyone wants to know, the problem was caused by IntPtr.
Basically, IntPtr(void*) does NOT wrap a pointer into a managed pointer. Instead, it creates a managed pointer TO an unmanaged pointer. Very wrong.
The solution was to simply use static_cast to convert the umanaged pointer into a managed one.
|
|
|
|
|
Hi
I am now working in c# with infragistics.
I am new to infragistics. so
i feel very difficult .
pls anyone can tell me the tutorials for infragistics which r easy to learn (other than http://devcenter.infragistics.com site)
j o h n
|
|
|
|
|
Please ,give me some information
|
|
|
|
|
I already re-draw listview Frame ,code:
private void OverrideControlBorder(Graphics g)
{
Pen BorderPen = new Pen(Color.FromArgb(127,157,185), 1);
g.DrawRectangle(BorderPen, new Rectangle(0, 0, this.Width - 1, this.Height - 1));
}
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_PAINT:
IntPtr hDC = IntPtr.Zero;
Graphics gdc = null;
hDC = GetWindowDC(m.HWnd);
gdc = Graphics.FromHdc(hDC);
OverrideControlBorder(gdc);
if((this.Font.Height - 1) * this.Items.Count > this.Height)
{
OverrideVertScrollBar(gdc);
}
ReleaseDC(m.HWnd, hDC);
gdc.Dispose();
default:
break;
}
base.WndProc (ref m);
}
|
|
|
|
|
OverrideVertScrollBar(gdc);
about this function,How do I Write?
Thank you!
|
|
|
|
|
|
I used to know how to get a WinForm to display AND have the Console Window appear at the same time-
I don't really care if they overlap as long as both appear.
-- thanks in advance
|
|
|
|
|
Set the project type to Console Application.
There you go, you now have a console.
Then create any forms you wish.
There you go, you now have both.
|
|
|
|
|
i've created a form with 2 panels 3 button, 1 controlbox...
I need to draw a blue rect over all.
Can i do it directly using Graphics (no with picturebox)?
|
|
|
|
|
You can draw the rectangle in OnPaint, but I suspect you'd need to hide the controls, they will show through.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am killing myself trying to figure how to use something like AutoItDLL in C#. I posted the question to their forum, and they obviously don't seem to have a big C# following. Does anyone know of any tools like AutoItDLL.
(AutoIt is a simple tool that can simulate keystokes, mouse movements and window commands (maximize, minimize, wait for, etc.) in order to automate any windows based task (or even windowed DOS tasks).)
I am trying to avoid having to build this functionality from the ground by inheriting a bunch of stuff from the user32.dll (not lazy, but up against agressive timeline)
Any help would be GREATLY appreciated.
I am not apposed to using AutoItDLL but I can't find any sample code or produce and personal success with it thus far.
Thanks!!
|
|
|
|
|
Here's the deal:
I have a pointer to some unmanaged code, in the form of IntPtr.
It's a callback. Now how do I call it?
|
|
|
|
|
See if this helps
http://www.codeproject.com/csharp/Win32_to_NET.asp
Live Life King Size
Alomgir Miah
|
|
|
|
|
No, I'm afraid that is doing the thing in reverse. It is calling a .Net callback from unmanaged code. I, however, have the callback in unmanaged code and need to call it from .Net.
Every article about this seems to assume that the .Net app is "in control", which is really annoying, since right now, .Net is taking the orders from unmanaged code and I have no reference to go by
|
|
|
|
|
|
Nono, it's the opposite.
I don't need to make a delegate into an IntPtr, I need to basically make an IntPtr into a delegate.
|
|
|
|
|
Looks like a mixed-mode wrapper might be the answer. I haven't managed to get it to work yet, though (due to the PtrToStructure problem a few posts above).
|
|
|
|