Good point Nathen (i will give it a shot)

I tryed your code but the problem is that the button isan't reconised I have this code and i want to give the click event for btnOK an Event procedure eg: form1.backcolor = color.red

Code:
Public Sub NewAnimal()
              Dim form1 As New Form

              Dim btnOK As New Button
    
        btnOK.Text = "OK"
        ' Set the position of the button on the form.
        btnOK.Location = New Point(10, 10)
       
        form1.Text = "My Dialog Box"
        ' Display a help button on the form.
        form1.HelpButton = True

        ' Define the border style of the form to a dialog box.
        form1.FormBorderStyle = FormBorderStyle.FixedDialog
        ' Set the MaximizeBox to false to remove the maximize box.
        form1.MaximizeBox = False
        ' Set the MinimizeBox to false to remove the minimize box.
        form1.MinimizeBox = False
        ' Set the accept button of the form to button1.
        form1.AcceptButton = btnOK
        ' Set the cancel button of the form to button2.
        form1.CancelButton = btnCANCEL
        ' Set the start position of the form to the center of the screen.
        form1.StartPosition = FormStartPosition.CenterScreen

        ' Add button1 to the form.
        form1.Controls.Add(btnOK)
       
        ' Display the form as a modal dialog box.
        form1.ShowDialog()
    End Sub
thanks Michael