I am currently developping an app WinForm using vb.net and i have to call a function, situated in my main form, in another form. Here is my function in my main form
Public Sub ImprimCalibrage(t1 As String, t2 As String)
Dim strCalibr As String = Build_str("CAL", "CALIBRAGE", t1, t2)
BuildFile("fileT.txt", strCalibr)
Print()
End Sub
To call it, i have created an attribute in my secondary form like this
ReadOnly form1 = Application.OpenForms("Main")
And now i call my function doing this form1.ImprimCalibrage(TextBox1.Text, TextBox2.Text)
But when i click on the button which supposed excute the function, i got this error
'Object variable or With block variable not set.'
I don't have any idea how to solve it because i dont have with block and my only variable in just a String.