如何将2个值从函数(模块)返回到特定表单,从button1(form2)从按钮1(form1)加载数据 [英] How do I return 2 values from a function (module) to a specific form, load data from button1 (form2) from button's 1 (form1)
问题描述
再次问好,
我对我的项目有一些疑问。
我有这个形成,当我按下+ 120V时,我从[22,2]数组中加载了一些数据。然后,当我需要一个函数的2个返回值(下面的代码) expectedtime 和 scalings_plus 时,我会做一些算术运算。预计时间应该在表单的8.6分钟标签中。
Q1:我怎样才能将calculate.vb的预期时间返回到该表格和此标签?
另外,我该如何制作如果我将表单中文本框的值更改为100,则再次计算?
更具体地说,在下面的代码中,函数calc()内部需要一个vmax值,第一次我把它手动(120)当我按下第一种形式的+ 120V。
但是,下一个表格应该有另一个计算,我使用的是第一个使用的相同数组。
新的预期时间需要重新计算。
但是,我最担心的是,当我按下按钮时,我怎样才能执行此例程以及第一种形式的-120V。因为,它有不同的数据数组和不同的值,y1_err,x1_err,re_err。
Q2:当我按START时,如何调用函数计算文本框中的新值(例如100)?
谢谢
我的尝试:
这是按钮+ 120V的代码
Hello again,
I have some questions to make for my project.
I have this form, when I press the +120V I load some data from an [22,2] array. Then, I make some arithmetic calculations when I need 2 return values (code below) expectedtime and scalings_plus from a function . The expected time should be in the label "8.6 minutes" of this form .
Q1 :How can I return the expectedtime from the calculation.vb to that form and to this label?
Also, how can I make the calculations again if I changed the value on the textbox in that form to 100?
To, be more specific, in the code below , inside the function calc () needs a vmax value, the 1st time I put it manually (120) when I pressed the +120V in the 1st form.
But, there should be another calculation from the next form with the same array that I used by first place.
And the new expectedtime needs to be recalculate .
However, my biggest worry is how can I do this routine and for the -120V in the first form when I press the button. Because , it has a different array of data and different values ,y1_err , x1_err,re_err.
Q2: How can I call the function calculation when I press the START with the new value in the textbox (e.g 100)?
Thank you
What I have tried:
This is the code from button +120V
Public data As Double(,)
Public Sub Button2_Click(sender As Object, e As EventArgs) Handles btnP120.Click
data = {{0.05, 0.4568666}, {0.06, 0.57215975}, {0.07, 0.69595725}, {0.08, 0.809528},
{0.09, 0.9307419}, {0.1, 1.05572355}, {0.11, 1.1766145}, {0.12, 1.29363005}, {0.13, 1.41333685},
{0.14, 1.5303524}, {0.15, 1.6515663}, {0.16, 1.76556765}, {0.17, 1.8864586}, {0.18, 2.00229},
{0.19, 2.1282405}, {0.2, 2.243426}, {0.21, 2.3629175}, {0.22, 2.480256}, {0.23, 2.5997475},
{0.24, 2.7203155}, {0.25, 2.837654}, {0.26, 2.9571455}}
calculations.calc(data, 11.676, 11.79, 0.004427, 120)
Mproduction.Show()
Me.Hide()
End Sub
来自按钮-120的代码
The code from button -120
Public dataN120 As Double(,)
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnN120.Click
dataN120= {{0.05, 0.67356605}, {0.06, 0.7972559}, {0.07, 0.9133026}, {0.08, 1.0325788}, {0.09, 1.15131675}, {0.1, 1.2696241}, {0.11, 1.395144},
{0.12, 1.51086775}, {0.13, 1.6263762}, {0.14, 1.7490972}, {0.15, 1.86611275}, {0.16, 1.98345125}, {0.17, 2.10380395}, {0.18, 2.221896}, {0.19, 2.348923},
{0.2, 2.4619555}, {0.21, 2.5825235}, {0.22, 2.706321}, {0.23, 2.822583}, {0.24, 2.940998}, {0.25, 3.0626425}, {0.26, 3.179981}
calculations.calc(dataN120, 11.944, 12.06, 0.002574, 120)
Mproduction.Show()
Me.Hide()
End Sub
我称之为
And the module that I call the function
推荐答案
查看此问题的答案在form1和form2之间传递Vb.net变量 [ ^ ]
See the answers to this question Vb.net variable pass between form1 and form2[^]
这篇关于如何将2个值从函数(模块)返回到特定表单,从button1(form2)从按钮1(form1)加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!