Derived Button Control Subclass Issue

  • Thread starter Thread starter gregarican
  • Start date Start date
G

gregarican

There is a C# CTI app I'm working on using Visual Studio 2005 at
revision level 8.0.50727-7600. I need a couple of Windows Form Button
controls to emulate line buttons on a telephone. So I went to create a
class file for the user control to subclass this out. Something basic
for a start, just initializing things. When I drag this custom control
from the Toolbox to my form then Visual Studio just abruptly exits
without warning.

So I tried to create a custom button control as part of a custom
Control Library DLL file. When I add this reference to a new project
and then try to drag in the custom control the same thing happens.
Visual Studio just vanishes.

I have tried subclassing the Button class, the UserControl class, the
Control class, etc. All with the same result. I have tried each time
with just a new project with nothing else in it other than the default
elements. When I try this out on another PC using Visual C# 2005
Express it works fine and I can drop in the custom button control
without incident.

Has anyone else experienced something similar?
 
There is a C# CTI app I'm working on using Visual Studio 2005 at
revision level 8.0.50727-7600. I need a couple of Windows Form Button
controls to emulate line buttons on a telephone. So I went to create a
class file for the user control to subclass this out. Something basic
for a start, just initializing things. When I drag this custom control
from the Toolbox to my form then Visual Studio just abruptly exits
without warning.

So I tried to create a custom button control as part of a custom
Control Library DLL file. When I add this reference to a new project
and then try to drag in the custom control the same thing happens.
Visual Studio just vanishes.

I have tried subclassing the Button class, the UserControl class, the
Control class, etc. All with the same result. I have tried each time
with just a new project with nothing else in it other than the default
elements. When I try this out on another PC using Visual C# 2005
Express it works fine and I can drop in the custom button control
without incident.

Has anyone else experienced something similar?

When you say you want to emulate line buttons on a telephone, what do
you mean? Do you mean buttons that select the particular phone line
to use? Have you tried using a RadioButton with its appearance set to
Button?

I'm sorry I don't have a solution for your crashing VS problem.

Chris
 
Hi,

I have tried subclassing the Button class, the UserControl class, the
Control class, etc. All with the same result. I have tried each time
with just a new project with nothing else in it other than the default
elements. When I try this out on another PC using Visual C# 2005
Express it works fine and I can drop in the custom button control
without incident.

Has anyone else experienced something similar?

Not, I have never seen VS crash like that.

Are you sure you are following all the steps to make your new control
available from the toolbox?

If so I suggest you to create a bug report with MS regarding this.


Sorry not be able to help you more.
 
When you say you want to emulate line buttons on a telephone, what do
you mean? Do you mean buttons that select the particular phone line
to use? Have you tried using a RadioButton with its appearance set to
Button?

I'm sorry I don't have a solution for your crashing VS problem.

Chris- Hide quoted text -

- Show quoted text -

There are several different states of a LineButton control that I
wanted to use. It is either ringing, idle, or holding a call. I
figured I could subclass a Button control and then add Property gets
and sets for these states. A RadioButton control wouldn't offer me the
same clean feature set since I want to conditionally change the
BackColor, Image, and other things as well.

I will read up some more on the recommended steps of subclassing an
existing Windows Form control and ensure I'm going through the steps
correctly as the other poster suggested. We'll see...
 
There are several different states of a LineButton control that I
wanted to use. It is either ringing, idle, or holding a call. I
figured I could subclass a Button control and then add Property gets
and sets for these states. A RadioButton control wouldn't offer me the
same clean feature set since I want to conditionally change the
BackColor, Image, and other things as well.

I will read up some more on the recommended steps of subclassing an
existing Windows Form control and ensure I'm going through the steps
correctly as the other poster suggested. We'll see...

Hi,

What do you mean by subclassing? Inheritance?

There shouldn't be a problem inheriting a windows forms control (that
is inheritable).

Moty
 
Hi,

What do you mean by subclassing? Inheritance?

There shouldn't be a problem inheriting a windows forms control (that
is inheritable).

Moty- Hide quoted text -

- Show quoted text -

I think I found the issue. In my inherited Button control I had a
couple of boolean fields that I made public through properties. When I
excluded using these then the control dropped into my main form fine.
When I included these into the inherited button control again then the
action made VS disappear. Definitely a bug. My Visual C# 2005 Express
IDE didn't care one way or the other. But I am working fine now.
Instead of using a boolean true/false I just zero out the integer
value I'm referring to...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top