473,509 Members | 3,095 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'Specified Cast Is Not Valid' With EnvDte and UserControl

LC
Hi There,

I had made a Form Generator AddIn with EnvDte. Its all working well
generating TextBox, CheckBox, ComboBox, etc, etc. Now I want the
generator to make my forms using my UserControls that is simply
Inherited from TextBox, CheckBox, with some plus properties and
methods.

Problem is: After i create the controls on the form via
CreateComponent, i want to reference the object in a variable of the
same type to complete all the other properties. Here is some code:

Dim objCheckComp As System.ComponentModel.IComponent
objCheckComp = objHost.CreateComponent(objHost.GetType("Friendshi p.fsCheckBox,Friendship"),
"chk" & strFieldName)
Call PropSet(objCheckComp, "Parent", objPanelComp)
Dim objCheck As Friendship.fsCheckBox
objCheck = objPanel.Controls(objPanel.Controls.Count - 1) --- In This
Line I Got The Exception ---

And the worst part is that if i stop before that line with a
breakpoint and copy the line to the immediate pane and just execute
it,
it work perfect. Then i skip the line on the code hit F5 and the
everting works fine including using that 'Immediate Created Object'.

Any help please, this driving me crazy

LC
Jul 19 '05 #1
0 1752

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3610
by: Tao | last post by:
I just upgraded .NET framework to 1.1 and VS.Net to 2003 version and tried to test it out. I created an ASP.NET project using the wizard and tried to run it by hitting "F5". I got an exception:...
0
1161
by: Andrew | last post by:
Can someone out there help. I am using Server. Transfer from a user control to a webform and tried to follow many examples exactly as specified but cannot get around the (Specified cast is not...
3
10494
by: PK9 | last post by:
I am looking for assistance in pinpointing the cause of the following exception. I am getting a "Specified Cast is not valid" exception on my page. I am trying to populate a datagrid. One of my...
2
3082
by: Fabian | last post by:
Hi, I work with asp.net 2.0 and I have a intermittent error, only happens a few times a day. In the page I evaluate a Query String and then I get data form a database. The code snipped: ...
3
2167
by: VB Programmer | last post by:
I am setting up forms authentication. In my code I keep getting this error. Any ideas? Error.... Server Error in '/LandOLots' Application....
0
623
by: QA | last post by:
I am using a Business Scorecard Accelarator in a Sharepoint Portal 2003 using SQL Server 2005 I am getting the following error: Error,5/7/2005 10:50:14 AM,580,AUE1\Administrator,"Specified cast is...
0
1600
by: Alan Z. Scharf | last post by:
this question in datagrid group for several days with no repsonse. I'm hoping for an answer her because of greater activity in this group. No cross-posting intended. Thanks....
0
316
by: LC | last post by:
Hi There, I had made a Form Generator AddIn with EnvDte. Its all working well generating TextBox, CheckBox, ComboBox, etc, etc. Now I want the generator to make my forms using my UserControls...
2
1612
by: tlk | last post by:
Hi, everyone. I'm having a problem that I hope some more experienced developers can help me figure-out. We have a project called Records that has been around for a year or so. We're currently...
0
7234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7136
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7412
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4730
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.