Public Class Form1 Private sharedResult As String Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click '① 'Environ関数の戻り値を sharedResult に代入します。 sharedResult = Environ("USERPROFILE") End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click '② '①で呼び出したEnviron関数の戻り値を使用します。 MsgBox("Button1_Clickで取得した値=" & sharedResult) End Sub End Class