Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3359532
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:53:01+00:00 2026-05-18T02:53:01+00:00

I have a strong C++ background and I’m just starting to use C#. In

  • 0

I have a strong C++ background and I’m just starting to use C#.

In a test application I write the following construction (wf is an instance of a class that I just wrote myself):

wf.m_button = new Button();
wf.m_button.FlatStyle = FlatStyle.System;

But the compiler (Visual C# Express 2008, using .Net 3.5) gives me this error:

‘System.Windows.Forms.Control’ does not contain a definition for ‘FlatStyle’ and no extension method ‘FlatStyle’ accepting a first argument of type ‘System.Windows.Forms.Control’ could be found (are you missing a using directive or an assembly reference?)

If I change the code to this:

Button button = new Button();
wf.m_button = button;
button.FlatStyle = FlatStyle.System;

This works.

Why is instance.property.property not allowed in C#, while in C++ you can easily write something like this:

myVariable->myDataMember->anotherDataMember = ...;
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:53:01+00:00Added an answer on May 18, 2026 at 2:53 am

    It has nothing to do with property chaining. You have declared m_button as a Control object, not a Button. The Control class does not expose a FlatStyle property. Even though you know that m_button is a Button under the covers, the compiler cannot determine that as you could assign anything to m_button that is an instance of a Control object or a descendant of the Control class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strong database background but very little practical experience with ms sql
I have a strong j2ee background, and I am trying to move to objective-c
I'm fairly new to PowerShell, but have a strong C# background. The task I'm
Background: I have string of html with about 10 image tags that passes through
I have a strong use case for pre-allocating all the memory I need upfront
This is an SDL problem, however I have the strong feeling that the problem
I am a C++ developer, but don't have a strong background in Windows development.
Okay, so I am new to Ruby and I have a strong background in
I have an element like this: <p>My text with a <strong class=highlighted>sample highlight</strong>.<p> And
I cannot say I have a strong C++ background so I hear Handle very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.