link between text boxes
Asked By David
02-Sep-10 11:41 PM
suppose i have two text boxes one is for total and another for discount...
suppose whenever i enter value (10%) in the discount text box it should apply discount formula on the tota l(500) and new value(450) again shoud remain in the total text box...
for ex. total is 500 and i entered value in discount 10 then the new result in total text box should be 450....
i am begineer in c#.. i tried many times ..but it is not working...plx suggest how to do that ....
any help would be appreciated...
re: link between text boxes
Shunmuga Nathan replied to David
03-Sep-10 01:38 AM
Try the following code
txtTotel.Text = ( Convert.ToDouble(txtTotel.Text) - ( Convert.ToDouble(txtTotel.Text) * Convert.ToDouble(txtDiscount.Text) / 100)).ToString();
re: link between text boxes
Sagar P replied to David
03-Sep-10 03:14 AM
What you can do is, take one global static variable and store your total in that variable like;
static int total = 500;
And then on text changed event of Discount text box write this code;
private void txtDiscount_TextChanged(object sender, EventArgs e)
{
if (txtDiscount.Text !="")
{
txtTotal.Text = (total - (total * Convert.ToDouble(txtDiscount.Text) / 100)).ToString();
}
}
re: link between text boxes
Goniey N replied to David
04-Sep-10 08:33 AM
-- Use Below Code :
1.private void button1_Click(object sender, EventArgs e)
2.{
3. txtTotal.Text = Convert.ToString(Convert.ToDouble(txtTotal.Text) - (Convert.ToDouble(txtTotal.Text) * Convert.ToDouble(txtDiscount.Text)) / 100);
4.}
-- For More Clear View See Below Images :
-- Before Click On The Calculate Button...
-- After Click On Calculate Button....
-- It Will Work 100%...
-- Hope This Help You...


page load. Write this code: MyLabel.Text = System.DateTime.Now.ToString() BindData() and grid refresh time is: Protected Sub Timer1_Tick( ByVal sender As Object , ByVal e As EventArgs) Label1.Text = "Grid Refreshed at: " + DateTime.Now.ToLongTimeString() End Sub myGrid.DataSource = ds; myGrid.DataBind(); } protected void Page_Load(object sender, EventArgs e) { / / You can check your current time on page load. Write this code: lblTime.Text = System.DateTime.Now.ToString(); DisplayData(); } protected void Timer1_Tick(object sender EventArgs e) { / / Datagrid refresh time lbldgTime.Text = "Refresh at:" + System.DateTime.Now.ToString(); DisplayData(); } / / This is HTML Code: <form id = "form1" runat = "server Label > < / ItemTemplate > < / asp:TemplateField > < asp:TemplateField HeaderText = "<font color = 'red' > Link Name< / font > "> < ItemTemplate > < asp:Label ID = "Label2" runat = "server" Text code like below : SqlConnection cn; protected void Page_Load( object sender, EventArgs e) { cn = new SqlConnection( " put your connection string" ); bindData(); } void 0]; GridView1.DataBind(); Label1.Text = "Grid Refreshed at :" + DateTime.Now .ToString (); } Thanks its working. . . but now a new issue came out later!! ok. . . . This is the Buddy.aspx page. . . . . . . . . . . . - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- <%@ Page Language = "C#" MasterPageFile = "~ / MasterPage.master" AutoEventWireup = "true" CodeFile = "Buddy.aspx.cs" Inherits
a simple Windows Forms application that uses the SQLite3.dll C library coupled with the SQLite.NET.dll ADO.NET managed button3_Click and button4_Click, respectively: private void button3_Click(object sender, System.EventArgs e) { / / this is the "INSERT" button handler- - / / "path" is declared cmd2.Dispose(); con2.Close(); } private void button4_Click(object sender, System.EventArgs e) { / / This is the "Retrieve" button Handler- - string dbpath = path but make sure we / / know to close it when were done. if (command.Connection.State ! = ConnectionState.Open) { command.Connection.Open paramList) { t = o.GetType(); SQLiteParameter parm = new SQLiteParameter(); if ( t.ToString() = = "System.String" ) { parm.DbType = DbType.String ; parm.ParameterName = paramNames[j string )paramList[j]; coll.Add(parm); goto cont; } if (t.ToString() = = "System.Byte[]" ) { parm.DbType = DbType.Binary; parm.ParameterName = paramNames[j byte [])paramList[j]; coll.Add(parm); goto cont; } if (t.ToString() = = "System.Int32" ) { parm.DbType = DbType.Int32; parm.ParameterName = paramNames[j int )paramList[j]; coll.Add(parm); goto cont; } if (t.ToString() = = "System.Boolean" ) { parm.DbType = DbType.Boolean; parm.ParameterName = paramNames[j bool )paramList[j]; coll.Add(parm); goto cont; } if (t.ToString() = = "System.DateTime" ) { parm.DbType = DbType.Boolean; parm.ParameterName = paramNames[j ToDateTime(paramList[j]); coll.Add(parm); goto cont; } if (t.ToString() = = "System.Object" ) { parm.DbType = DbType.Object; parm.ParameterName = paramNames[j
com 1 8 B B b@b.com 2 9 c c c@c.com 8 10 D D d@d.com 9 11 purposes, assume that A introduces B and E. B introduces C and F. C introduces D. D introduces G. We recommend candidate D to com 1 8 B B b@b.com 2 9 c c c@c.com 8 10 D D d@d.com 9 for
with the following : In all uu en / decoding code in C / C++ / VC++ a en / decoding algorithim called ENC or DEC is used which is as follows #define ENC(c) ((c c) & 077) + ' ': '`') #define DEC(c) (((c) - ' ') & 077) c is a char and this returns int I need the DEC functionality in C# . . . any help (any c gurus around). Note: I am using this function in C
Advantage of c# over c, c++, java Here i will provide you the some advantage of c# over c, c++ and java. Advantages over C and C++ It is compiled to an intermediate language (CIL) indepently of Apps can be executed within a restricted sandbox Advantages over C++ and java Formalized concept of get-set methods, so the run on top of the virtual machine (CLR) Advantage of c# over c, c++, java ( 614 Views ) View j Miracle's
dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { } private void button1_Click(object sender, EventArgs e) { } private void BalanceForm_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel Hide(); this.WindowState = FormWindowState.Normal; } private void BalanceForm_Load(object sender, EventArgs e) { this.dataGridView1.Rows.Add(34); this.dataGridView2.Rows.Add Cells[1].Value = "mg / lt"; } private void BalanceForm_Activated(object sender, EventArgs e) { / / GASTO this.dataGridView1.Rows[0].Cells[0].Value = "Gasto m3 / dia"; this.dataGridView1.Rows[0].Cells[2].Value = Convert.ToDouble(this.dataGridView2.Rows[0].Cells[2].Value); this.dataGridView1.Rows[1].Cells[2].Value = (Convert.ToDouble(this.dataGridView1.Rows[0].Cells[2].Value) * 86400) / 1000; this 0.05; this.dataGridView1.Rows[1].Cells[17].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[17].Value)*86400 / 1000; this Gastomedio1 + double.Parse(this.dataGridView1.Rows[0].Cells[17].Value.ToString()); this.dataGridView1.Rows[1].Cells[3].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[3].Value) * 86400 / 1000; this dataGridView1.Rows[0].Cells[5].Value = (Convert.ToDouble(this.dataGridView1.Rows[3].Cells[4].Value)) * 5 / 86400; this.dataGridView1.Rows[1].Cells[5].Value = Convert.ToDouble(this.dataGridView1.Rows[0].Cells[5].Value) * 86400 / 1000; this
Hi, I have 4 different application develop in different languages(c / c++, c# and java), all of them already done and stable, I need to integrate those 4 application into 1 using c#. Is this possible? Can anyone gave me a hint or
is Microsoft Intermediate Language ? hi, MSIL was designed to support C, C++, C#, Visual Basic, Cobol, Perl, Fortran and many other languages. Microsoft discusses about msil in detail in the following link: http: / / www.msdn.microsoft.com / library / default.asp?url = / library