mardi 23 juillet 2019

Dim Form as as specific Form with if-statment

I have a Sub, wich works for two different Forms. So when I call the Sub form one of this Forms I give the Form to the Subas a paramenter. How can I set the correct for as a Variable in the Sub?

Here are two way I have tryed this, but it does not work.

Shared Sub SetDataGridViewg(ByRef Form As Form, AusAuftrag As Boolean)
    Dim AdressenÜbersicht = If(AusAuftrag, CType(Form, AdressenÜbersichtAusAuftrag), CType(Form, Startseite))

        If AusAuftrag Then
            Dim AdressenÜbersicht As AdressenÜbersichtAusAuftrag = CType(Form, AdressenÜbersichtAusAuftrag)
        Else
            Dim AdressenÜbersicht As Startseite = CType(Form, Startseite)
        End If

Aucun commentaire:

Enregistrer un commentaire