|
Hi,
i want add(not sum) the two difrrent integer veriables value in an array
like this
int i=14;
int j=15;
int []array=new int[3];
array[0]=??? i j
then out of array[0]=1415
I AM WORKING ON "PLOTTER ROBOT"(FYP).
|
|
|
|
|
if i use
string [] str=new string[3];
int i=14;
int j=15;
array[0]=""+i+""+j;
then
array[0]=1415
is it possible in int[]?
I AM WORKING ON "PLOTTER ROBOT"(FYP).
|
|
|
|
|
Convert the two integers into strings, concatenate and assign.
|
|
|
|
|
You get the number if digits in j(it's easier to covert it to string and use the Length property)
private static string Add(int i, int j)
{
int result = (int)(i * (int)Math.Pow((double)10, (double)(j.ToString().Length)) + j);
return result.ToString();
}
Be carefull..this method returns the result as a string..as "adding" to integers might be bigger than Int32.MaxValue !
|
|
|
|
|
Ups..I didn't see that someone already answered.. sorry
|
|
|
|
|
Hi,
I have a Client Server Application that communicates through
socket.
The Client is a VC++(6.0 version) and the Server is a C# application.
While trying to connect to the Socket from the VC++ application by entering the ip for example in - 012.220.200.001 - format I am unable to connect to the listening Socket. I get 10061 or 10049 exception.
But when I try to connect to the Socket server by entering the ip in the format 127.000.000.001(localhost), I am able to connect.
I want to connect to the Server by entering the ip address in either ways.
Please suggest.
Let me know if I will have to change the listen functionality which is currenty
Socket workerSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp)
IPEndPoint ipLocal = new IPEndPoint (IPAddress.Any, port);
m_mainSocket.Bind( ipLocal );
m_mainSocket.Listen(4);
With Thanks and Regards,
Abraham Chethuvelil
|
|
|
|
|
Are you in a local network? ie. Connected to the internet through a router or similar?
Because if you are, and you enter your IP address, you are besically sending the request to the router, which has no idea what machine to pass it on to.
You'd have to set up some port forwarding to get it to work.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
Hi!
I think the format of your IP address is screwed.
If you start it with '0' the numbers will be interpreted as octal.
I just tried a ping to "012.220.200.001" and ping told me that it actually tried to connect to 10.220.200.1!
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
|
Member 3499052 wrote: How can i calculate this text box.
TextBox1.Text = "1+2+3";
to giv me int total = 6;
Hi,
you can do this with below code..
<br />
int i = 1+2+3;<br />
TextBox1.Text = i.ToString();<br />
Hope it will help you.
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
thanks but i think we misunderstud
i have a gridview where you can clik on row and the value of the row is typing in textbox
like this
this is a textbox.Text = 1+3+4+5+6.
now a need a function to calculate that.
i have this code
int i = Convert.ToInt32(TextBox1.Text);
Label1.Text = i.ToString();
But its not working ;-(
Thanks very mutch..
|
|
|
|
|
Hi,
first of all what are you diong ? what you wanna do its yet not clear.
Member 3499052 wrote: textbox.Text = 1+3+4+5+6
<br />
int i = 1+3+4+5+6;
textbox.Text =i.ToString();
Now
Member 3499052 wrote: int i = Convert.ToInt32(TextBox1.Text);
Label1.Text = i.ToString();
No need for this,
Just write,
Label1.Text = TextBox1.Text;
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
He wants to write a calculator, where he can type into a textbox "1+2-3*4" and it does the calculating for him.
ie/ you've totally misunderstood the point!
|
|
|
|
|
Ohhhh,
ya really man...
Thanks,
Sun Rays
To get something you must have to try once.
My Articles
|
|
|
|
|
You need an expression evaluator like this[^] one.
|
|
|
|
|
thank you but how ?
can you write a exampel ? thanks very mutch
|
|
|
|
|
If you'd followed the link you'd have found a whole article about one. I'm curious as to why you voted me down for pointing you towards the answer.
|
|
|
|
|
sorry i that it was a page list .. i wrote u up now.. sorry..
thanks very mutch
|
|
|
|
|
No problem - BTW, I really like that article which is why I pointed you to it. It's very good.
|
|
|
|
|
sorry but i have no ide how its works.. i read the articel but i did't understand.
|
|
|
|
|
Include a reference to his assembly in your project and then do the following:
ExpressionEval eval = new ExpressionEval(txtFunction.Text);
object output = eval.Evaluate();
if (output != null)
{
}
|
|
|
|
|
Please don't delete your message once someone has replied. It kind of dirties the forums.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hello all,
I need an example how to populate outlook and outlook express with html body.
The user can edit the mail within his client before submission.
The scenario would be like this:
====================================
1. In winform configuration the user will define his mail client.
outlook or outlook express
2. On winform user will click send mail.
3. New mail form of the user client will popup, filled with :
from: , to: and the messaqge body populated with html rendered at winform.
4. While new mail client is open, the user can edit the mail message and the submission action will be triggered by the user.
Thanks
Tsachi
|
|
|
|
|
Hi to all!!!
I have a class & in constructor I call for "webBrowser = new WebBrowser();"
There I get thread state exception (ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment.).
The interesting thing is that the first time i call that class no exception is made.
Then I destroy that instance and make a newone that throws exception.
I use that class for some gdi+ stuff, I also use background worker.
thx
|
|
|
|
|
Hi,
I suggest you create all WebBrowser instances in the main or GUI thread.
Since your class constructor contains "new WebBrowser()" it too should only be instantiated
by the main thread, not by a BackgroundWorker thread.
|
|
|
|