如何在C#中使用公式 [英] How to use formulas in C #

查看:275
本文介绍了如何在C#中使用公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,

我不知道在C#中为下面的表格编写代码的想法。



in first form1



数量必须考虑在内。



格式2



计划数量,个人数量必须考虑在内。换句话说



我必须得到的结果为Total =(form1Qty)*(form2(planQty * individualQty))



任何解决我问题的人都将受到高度赞赏。



有问候。



我尝试过:



我没有尝试,因为我不知道如何编写代码。

sir,
I do not know the idea of writing a code for the tables given below in C#.

in first form1

Qty must be taken in account.

in the form2

Plan Qty, individual Qty must be taken into account. In other words

I must get the result as Total = (form1Qty)*(form2(planQty*individualQty))

Anyone solving my problem will be high appreciated.

With Regards.

What I have tried:

I have not tried since I do not know how to write the code.

推荐答案

你需要得到一个关于基础C#的好书并开始学习。你可以在这里下载Charles Petzold的免费.NET Book Zero:[ ^ ]。



从小代码示例开始,将它们从书中复制到IDE中。运行它们。学习如何在代码中设置断点以停止程序执行,然后检查变量的状态(值)。



拿你的公式,然后写下来一系列步骤将描述它的作用。例如,公式:



净利润=总销售额 - (总销售额*税率) - 每月营业费用


可以描述为:



a。得到总销售额并将其存储在一个变量中



b。获得税率并将其存储在一个变量中



c。获得运营费用并将其存储在一个变量中



d。将总销售额乘以税率,并存储此值



e。计算总销售额减去税收 - 运营费用并将其存储在变量中



学习计算机语言(或人类语言)时,每个人都必须经历一个初步的学习曲线)。我们大多数人需要对基本信息进行多次传递,并反复练习使用该基本信息,以便开始真正使用该语言编程。没有其他人可以为你做这件事。
You need to get a good book on basic C# and start studying. You can download the free ".NET Book Zero" by Charles Petzold here: [^].

Start off with small code-examples, copying them from the book into your IDE. Run them. Learn how to set a break-point in code to stop program execution, then examine the state (the values) of variables.

Take your formula, and then write down a series of steps that will describe what it does. For example, the formula:

Net Profit = Total Sales - (Total Sales * Tax Rate) - OperatingExpenses per Month

can be described as:

a. get the total sales and store it in a variable

b. get the tax rate and store it in a variable

c. get operating expenses and store it in a variable

d. multiply the total sales times the tax rate, and store this value

e. calculate total sales minus tax - operating expenses and store that in a variable

There's an initial learning curve everyone has to go through when learning a computer language (or a human language). Most of us need to make multiple passes over the basic information and to practice using that basic information repeatedly in order to begin to really program in that language. No one else can do this for you.


在c#web应用程序中有很多方法在表单和页面之间传递数据。



它取决于您的需求,您可以使用临时数据表来传递数据。或会话变量,或者您可以使用cookie或viewstate变量(如果使用asp.net)或查询字符串。

这些是用于在两个页面之间传递数据的方法,它们各有优缺点。根据您的问题,您可以使用查询字符串或临时数据表在表单之间传递数据。查询串不安全。

专注于c#应用程序开发的基础知识是很好的。
there are many ways of passing data between forms and pages in c# web application.

it depends on the your needs, you may use the temp data tables to pass the data . or session variables or you may use the cookies or the viewstate variable (if using asp.net) or querystrings .
These are the methods used to pass data between two pages and they have their own advantages and disadvantages. according to your question you may use the querystring or temp data table to pass the data between forms. querystring is not safe.
It is good to concentrate on the basics of the c# application development.


这篇关于如何在C#中使用公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆