Vb.net 如何在VisualBasic2008中创建动态文本框

Vb.net 如何在VisualBasic2008中创建动态文本框,vb.net,visual-studio-2008,Vb.net,Visual Studio 2008,我是vb 2008的新手,我正在尝试制作一个计算摩尔浓度(化学)的应用程序 以下是方程式(非化学) 其中M1和M2为摩尔浓度,V1、V2为体积(所有变量) 所以对于我的应用程序,我制作了四个文本框和一个按钮。现在我所做的是,当提供其他三个值时,我的应用程序只能找到一个变量M2 乙二醇 我想知道如何使这个应用程序更具动态性 比方说 我想找到 M1,M2,V1 or V2 any of these,just providing the other three values 我想可以用if-e

我是vb 2008的新手,我正在尝试制作一个计算摩尔浓度(化学)的应用程序

以下是方程式(非化学)

其中M1和M2为摩尔浓度,V1、V2为体积(所有变量)

所以对于我的应用程序,我制作了四个文本框和一个按钮。现在我所做的是,当提供其他三个值时,我的应用程序只能找到一个变量M2

乙二醇

我想知道如何使这个应用程序更具动态性

比方说 我想找到

   M1,M2,V1 or V2 any of these,just providing the other three values
我想可以用if-else语句完成,但我不知道怎么做


提前感谢您的帮助

我会以这种方式处理此事

我将命名我的四个文本框:

txtM1
txtM2
txtV1
txtV2
然后

创建:

 Private Sub textbox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtM1.TextChanged, txtM2.TextChanged, txtV1.TextChanged, txtV2.TextChanged
               Select Case True
        Case txtM1.Text <> "" AndAlso _
             txtV1.Text <> "" AndAlso _
             txtV2.Text <> ""
            txtM2.Text = CInt((txtM1.Text * txtV1.Text) / txtV2.Text)
        Case txtM2.Text <> "" AndAlso _
             txtV1.Text <> "" AndAlso _
             txtV2.Text <> ""
            txtM1.Text = "Your formula for M1"
        Case txtM1.Text <> "" AndAlso _
             txtM2.Text <> "" AndAlso _
             txtV1.Text <> ""
            txtV2.Text = "Your formula for V2"
        Case txtM1.Text <> "" AndAlso _
             txtM2.Text <> "" AndAlso _
             txtV2.Text <> ""
            txtV1.Text = "Your formula for V1"
    End Select        End Sub
Private Sub textbox\u TextChanged(ByVal sender作为对象,ByVal e作为System.EventArgs)处理txtM1.TextChanged、txtM2.TextChanged、txtV1.TextChanged、txtV2.TextChanged
选择Case True
案例txtM1.文本“”和_
txtV1.Text“”和_
txtV2.Text“”
txtM2.Text=CInt((txtM1.Text*txtV1.Text)/txtV2.Text)
案例txtM2.Text“”和_
txtV1.Text“”和_
txtV2.Text“”
txtM1.Text=“M1的公式”
案例txtM1.文本“”和_
txtM2.Text“”和_
txtV1.Text“”
txtV2.Text=“V2的公式”
案例txtM1.文本“”和_
txtM2.Text“”和_
txtV2.Text“”
txtV1.Text=“你的V1公式”
结束选择结束子对象

…试着对你得到的一些帮助进行投票。亲爱的朋友们,对不起,我不知道如何接受答案,我试着投票给回复的答案,但stackover不允许我(上面说我的分数低于15分),无论如何谢谢你的回复
txtM1
txtM2
txtV1
txtV2
 Private Sub textbox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtM1.TextChanged, txtM2.TextChanged, txtV1.TextChanged, txtV2.TextChanged
               Select Case True
        Case txtM1.Text <> "" AndAlso _
             txtV1.Text <> "" AndAlso _
             txtV2.Text <> ""
            txtM2.Text = CInt((txtM1.Text * txtV1.Text) / txtV2.Text)
        Case txtM2.Text <> "" AndAlso _
             txtV1.Text <> "" AndAlso _
             txtV2.Text <> ""
            txtM1.Text = "Your formula for M1"
        Case txtM1.Text <> "" AndAlso _
             txtM2.Text <> "" AndAlso _
             txtV1.Text <> ""
            txtV2.Text = "Your formula for V2"
        Case txtM1.Text <> "" AndAlso _
             txtM2.Text <> "" AndAlso _
             txtV2.Text <> ""
            txtV1.Text = "Your formula for V1"
    End Select        End Sub