passing values between forms (winforms)

前端 未结 3 1491
终归单人心
终归单人心 2020-11-28 16:16

Wierd behaviour when passing values to and from second form.

ParameterForm pf = new ParameterForm(testString);

works

Parame         


        
3条回答
  •  一个人的身影
    2020-11-28 16:31

    When you want to use your second variant, you have to use a getString()-Method, where you can put the e.g. "testString". The way you wrote it, "testString" should be a method (and got brackets).

    EDIT (a bit more precise):

    You could write:

    pf.getString(testString);
    

    , if "pf" is an instance of your own class, otherwise you had to look up, whether you can retrieve a String in this class.

提交回复
热议问题