|
Hi...
currently i m using asp.net 2.0 (With C#)
i m having an formula in my string as "(((5+6+4)/15)*100))"
i would like to execute this string and get the resultant as integer.
Help me ...
- Karan
|
|
|
|
|
|
first convert the string into integer by Convert.ToInt32 then perform calculations
|
|
|
|
|
11Developer wrote: first convert the string into integer by Convert.ToInt32 then perform calculations
How will you convert this string "(((5+6+4)/15)*100)) " as interger ?
Did you check the answer of J4amieC ?
|
|
|
|
|
If d string is fixed then one can use like this
string s = "(((5+6+4)/15)*100)";
int int1 = Convert.ToInt32(s.Substring(3, 1));
int int2 = Convert.ToInt32(s.Substring(5, 1));
int int3 = Convert.ToInt32(s.Substring(7, 1));
int int4 = Convert.ToInt32(s.Substring(10, 2));
int int5 = Convert.ToInt32(s.Substring(14, 3));
int ans = (((int1+int2+int3)/int4)*int5);
|
|
|
|
|
That's great!!
I wonder if you can write the same logic for...
string s = "(((15+16+14)/115)*1100)";
and what about
string s = "(((-5+6+4)/15)*100)";
|
|
|
|
|
11Developer wrote: If d string is fixed then one can use like this
This is not like that. This is an Infix string. First of all you need to convert into of PostFix or Prefix to perform the calculation as the computer does internally.
For that you can simply use Data Structure like Stack or Tree .
|
|
|
|
|
Ya .. Infix to Postfix is the only option.. .
|
|
|
|
|
hii can anybody give me a link or matter to study for customize membership in which coding is done in csharp.actually i want to do customize membership using access database.i googled but all matter is available with vb coding(i tried n got errors).can i have it using csharp coding...thnks....
|
|
|
|
|
Hi,
Can anyone tell me how to resize the iframe in asp.net.
d'kng
|
|
|
|
|
d'kng wrote: how to resize the iframe in asp.net
By giving Height and Width of IFrame.
|
|
|
|
|
Really funny question to answer...
Whats so special about IFrame ??
|
|
|
|
|
thanks..Abhishek
I think i could not make u understand the issue.
I need to resize an Iframe at runtime, without using jquery. just using simple javascipt.
d'kng
|
|
|
|
|
See how I made Iframe in custom size.
<iframe src="mypage.aspx" frameborder="0" style="border: 0px none; width: 100%; height:250px;"></iframe>
|
|
|
|
|
my concern is that one should be able to pick the border of the iframe which is coming in a popup and then resize it. this code will fix the size (100%) as per the container.
|
|
|
|
|
yes.. Make
var ifr = docuement.getElementById('ifr');
ifr.style.width = "100%";
ifr.style.height = "100%";
See if it works ?
It will take the size of the container.
|
|
|
|
|
Thnaks ..
See..
On my page there is a link that opens a pop where I need to show the content of source page. so iuser Iframe inside popup.
Now user can make some changes in opened page inside iframe. I want user to be able to pick the corner of the Iframe and resize it as per his/her requirment.
Now on which event should I place your code:
var ifr = docuement.getElementById('ifr');
ifr.style.width = "100%";
ifr.style.height = "100%";
|
|
|
|
|
For that you need to take a lot of things into consideration.
Actually you need to handle get mousedown/mousemove/mouseup events of the element and get the actual mouseX position and Y position .
You might use
e.pageX ||(e.clientX + this.getDocumentElement().scrollLeft); to get the actual point.
Finally you need to change the width and height with moving co-ordinates.
|
|
|
|
|
d'kng wrote: asp.net
You would rather use a JavaScript for that.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
I have 2 classes in a code behind file. one for events of the webpage and another class for custom repeater control. I create an array in the page load event. During the execution when the control enters into custom repeater control class the array I created in the page load event is lost. how to retain that array so that I can access it from both the classes
|
|
|
|
|
declare the array as static array.
|
|
|
|
|
hi
i am very new to asp.net. It may be the simplest problem to u. but for me it is a bit difficult. I have written a code for inserting the values in the SQLEXPRESS in C#.but not able to insert it. Can Any one help me out. the code is as follows:
protected void Button1_Click1(object sender, EventArgs e)
{
SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString = @"Data Source=localhost\SQLEXPRESS;" +
"Initial Catalog=testdata;Integrated Security=SSPI";
try
{
myConnection.Open();
Label1.Text = "<b>Server Version:</b> " + myConnection.ServerVersion;
Label1.Text += "<br /><b>Connection Is:</b> " +
myConnection.State.ToString();
string insertSQL;
insertSQL = "INSERT INTO jobseekerinfo (";
insertSQL += "firstname, middlename, lastname, ";
insertSQL += "dob, address, city, state, zip, mobile, phone, engcollege, ";
insertSQL += "enguniversity, engaggergate, pucollege, puuniversity, pumarks,";
insertSQL += "school, scuniversity, scmarks, totalyears, totalmonths,";
insertSQL += "workplace, job, skills";
insertSQL += "VALUES ('";
insertSQL += TextBox1.Text + "', '";
insertSQL += TextBox2.Text + "', '";
insertSQL += TextBox3.Text + "', '";
insertSQL += TextBox29.Text + "', '";
insertSQL += TextBox5.Text + "', '";
insertSQL += TextBox11.Text + "', '";
insertSQL += TextBox12.Text + "', '";
insertSQL += TextBox14.Text + "', '";
insertSQL += TextBox6.Text + "', '";
insertSQL += TextBox15.Text + "', '";
insertSQL += TextBox4.Text + "', '";
insertSQL += TextBox8.Text + "', '";
insertSQL += TextBox9.Text + "', '";
insertSQL += TextBox10.Text + "', '";
insertSQL += TextBox30.Text + "', '";
insertSQL += TextBox31.Text + "', '";
insertSQL += TextBox32.Text + "', '";
insertSQL += TextBox33.Text + "', '";
insertSQL += TextBox34.Text + "', '";
insertSQL += TextBox35.Text + "', '";
insertSQL += TextBox36.Text + "', '";
insertSQL += TextBox18.Text + "', '";
insertSQL += TextBox19.Text + "', '";
insertSQL += TextBox20.Text + "', '";
insertSQL += "')";
SqlCommand cmd = new SqlCommand(insertSQL, myConnection);
int added = 0;
added = cmd.ExecuteNonQuery();
Label1.Text = added.ToString() + " records inserted.";
}
finally
{
myConnection.Close();
Label1.Text += "<br /><b>Connection Is:</b> " +
myConnection.State.ToString();
}
}
Thanks in advance
|
|
|
|
|
sumanmks wrote: but not able to insert it
We're not mindreaders you know. What error do you get?
|
|
|
|
|
It was a cross post and both we have missed it !!
|
|
|
|
|
hello sir,
there is no syntax errors
|
|
|
|