I have a form which passes some values to a sub in a Public Class. The sub performs some calculations and passes a string back to a textbox on the calling form. The method I have did work some time ago, but now no longer works.
What is the best way to do this?
' From command button on calling form
Call CalcPlanetPositions.Calc_Planet_Positions(geo_lon, geo_lat, altitude_above_sea, birthDateTime)
Public Class CalcPlanetPositions
Public Shared Sub Calc_Planet_Positions(ByVal GeoLon As Double, ByVal GeoLat As Double, _
ByVal AltitudeAboveSea As Double, ByVal BirthDateTime As DateTime)
' Instanstiate a form type to enable results to be passed back to a form control
Dim _f As frmCalculateChart = CType(My.Application.OpenForms("FormCalculate"), frmCalculateChart)
' _f Throws a Null Exception on next line
_f.txtResults.Text = "Birth date: " & BirthDate & " Birth time: " & BirthTime & vbCrLf & _
"Sid: " & CommonFunctions.Dec2hms(JulDaySidTime) & vbCrLf & ""