FormBorderStyle returned as None for RadForm when passed as Form to function

1 Answer 66 Views
Form
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Iron
Czeshirecat asked on 29 Sep 2022, 10:38 AM

Easy to reproduce.

Unzip attached. I've only included the project as the zipped solution with its lib was too big to upload.

In function that's located in a RadForm

void DoSomething(Form form)
{
  MessageBox.Show(form.FormBorderStyle.ToString());

  MessageBox.Show(this.FormBorderStyle.ToString());

}

It returns "none" if form is a RadForm. The 2nd messagebox shows "sizeable" as this is a radform.

I wondered why it's doing this if a RadForm is a descendent.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 03 Oct 2022, 12:18 PM

Hello, Claire, 

I have made the following modification and it shows the FormBorderStyle as expected now:

    public void DoSomething(RadForm form)
    {
      MessageBox.Show($@"Form borderstyle = '{form.FormBorderStyle}' 
If I use 'this' as in this.FormBorderStyle it's returned as '{this.FormBorderStyle}'");

    }

After further testing I have noticed that casting to Form actually makes the None value to be returned:

I would recommend you to make the input parameter type(RadForm).

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Form
Asked by
Czeshirecat
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or