vendredi 19 août 2016

VB check value of structure

I have two structures that sometimes one gets filled with data and sometimes both. I need to check either the whole structure to see if it has values or not or I'd be ok if I can even check just a variable to see if it has a value (which is what I have done below). When the code runs the btnTurn.Enabled is always disabled whether the structure has data or not. Could this be a problem with my boolean?

Structures

 Public Structure StructSurvData
            Friend szTBMNum As String
            Friend dblTBMElev1 As Double
            Friend dblTBMElev2 As Double
            Friend dblTBMElev3 As Double
            Friend dblBACKSIGHT1 As Double
            Friend dblBACKSIGHT2 As Double
            Friend dblBACKSIGHT3 As Double
            Friend dblFORESIGHT1 As Double
            Friend dblFORESIGHT2 As Double
            Friend dblFORESIGHT3 As Double
            Friend szNewMPEDescr As String
            Friend szDataComm As String

        End Structure

        Public Structure StructSurvData2
            Friend szTBMNum2 As String
            Friend dblTBMElev4 As Double
            Friend dblTBMElev5 As Double
            Friend dblTBMElev6 As Double
            Friend dblBACKSIGHT4 As Double
            Friend dblBACKSIGHT5 As Double
            Friend dblBACKSIGHT6 As Double
            Friend dblFORESIGHT4 As Double
            Friend dblFORESIGHT5 As Double
            Friend dblFORESIGHT6 As Double
            Friend szNewMPEDescr2 As String
            Friend szDataComm2 As String
        End Structure

If/else

 If structSD2.szTBMNum2 = Nothing Then
                btnTurn.Enabled = False
            ElseIf structSD2.szTBMNum2 <> Nothing Then
                btnTurn.Enabled = True
            End If

Aucun commentaire:

Enregistrer un commentaire