473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem while casting

hello there

I was doing a project in VB.net and i used the following code to access the
element of the parent form

#################Code #####

DirectCast(Me.Owner, PhysicalInventoryfrm).drpInvName.DataSource =
inventoryCombodataset.Tables(0)

#########

where "PhysicalInventoryfrm" is the class of the Form whose element I want
to access. This worked fine. This piece of code was placed on some other
form.

When i tried to use same technique in C# as follows

((PhysicalInventoryfrm)this.Owner).drpInvName.Data Source =
inventoryCombodataset.Tables(0);

It gave me the compile time error "PhysicalInventoryfrm.drpInvName is
inaccessible due to its protection level." However i tried to change is
modifiers to public,internal etc also, but it didn't work.

Can anyone help me out in this case.

Thanks in advance
--
Sunil Pandita
Software Engineer
(OTS Solutions Pvt. Ltd. )

Nov 17 '05 #1
3 1176
"sunil" <su***@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
hello there

I was doing a project in VB.net and i used the following code to access
the
element of the parent form

#################Code #####

DirectCast(Me.Owner, PhysicalInventoryfrm).drpInvName.DataSource =
inventoryCombodataset.Tables(0)

#########

where "PhysicalInventoryfrm" is the class of the Form whose element I want
to access. This worked fine. This piece of code was placed on some other
form.

When i tried to use same technique in C# as follows

((PhysicalInventoryfrm)this.Owner).drpInvName.Data Source =
inventoryCombodataset.Tables(0);

It gave me the compile time error "PhysicalInventoryfrm.drpInvName is
inaccessible due to its protection level." However i tried to change is
modifiers to public,internal etc also, but it didn't work.

Can anyone help me out in this case.

Thanks in advance
--
Sunil Pandita
Software Engineer
(OTS Solutions Pvt. Ltd. )


Can we assume that this code is executing in an assembly other than the one
which declares PhysicalIniventoryfrm?

What is the protection level of PhysicalIniventoryfrm and its member
drpInvName?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk
Nov 17 '05 #2
hello Richard,

First of all, tahanks for giving your time,

"PhysicalInventoryfrm" is the form in VB.net and "drpInvName" is the
combobox in it having modifier 'Friend' .

Same thing i did in C#, created a form "PhysicalInventoryfrm" and kept a
combo box "drpInvName" on it. Now from the seconnd form i am trying to set
the datasource of this combobox.

It this point it gives me compile time error.

However the code in VB.net runs fine.

Thanks again and also in advance

--
Sunil Pandita
Software Engineer
(OTS Solutions Pvt. Ltd. )

"Richard Blewett [DevelopMentor]" wrote:
"sunil" <su***@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
hello there

I was doing a project in VB.net and i used the following code to access
the
element of the parent form

#################Code #####

DirectCast(Me.Owner, PhysicalInventoryfrm).drpInvName.DataSource =
inventoryCombodataset.Tables(0)

#########

where "PhysicalInventoryfrm" is the class of the Form whose element I want
to access. This worked fine. This piece of code was placed on some other
form.

When i tried to use same technique in C# as follows

((PhysicalInventoryfrm)this.Owner).drpInvName.Data Source =
inventoryCombodataset.Tables(0);

It gave me the compile time error "PhysicalInventoryfrm.drpInvName is
inaccessible due to its protection level." However i tried to change is
modifiers to public,internal etc also, but it didn't work.

Can anyone help me out in this case.

Thanks in advance
--
Sunil Pandita
Software Engineer
(OTS Solutions Pvt. Ltd. )


Can we assume that this code is executing in an assembly other than the one
which declares PhysicalIniventoryfrm?

What is the protection level of PhysicalIniventoryfrm and its member
drpInvName?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Nov 17 '05 #3
"sunil" <su***@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com...
hello Richard,

First of all, tahanks for giving your time,

"PhysicalInventoryfrm" is the form in VB.net and "drpInvName" is the
combobox in it having modifier 'Friend' .

Same thing i did in C#, created a form "PhysicalInventoryfrm" and kept a
combo box "drpInvName" on it. Now from the seconnd form i am trying to set
the datasource of this combobox.

It this point it gives me compile time error.

However the code in VB.net runs fine.

Thanks again and also in advance

--
Sunil Pandita
Software Engineer
(OTS Solutions Pvt. Ltd. )


Yes, but where is the code that attempts to get the datasource? Is it in the
same assembly or in a separate one?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk
Nov 17 '05 #4

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

Similar topics

2
by: ghostdog | last post by:
hi, i got this opengl/c++ code: <code> void render(CMesh *mesh){ ... float *pVertices; int *pIndices;
17
by: Jon Slaughter | last post by:
I'm having a little trouble understanding what the slicing problem is. In B.S.'s C++ PL3rdEd he says "Becayse the Employee copy functions do not know anything about Managers, only the Employee...
10
by: Ben | last post by:
Hi, I am a newbie with C and am trying to get a simple linked list working for my program. The structure of each linked list stores the char *data and *next referencing to the next link. The...
14
by: Jason Sewall | last post by:
Hello, I'm using the intel C++ 8.0 compiler on windows and I'm working on some software that uses the following lines of code: gf->invdim = 1.0/(double)dim; printf("invdim: %f\n",...
6
by: Carlo Marchesoni | last post by:
I have an ASP.NET/C# solution, where I can perfectly cast something I stored in the session object to a class of mine (BackEnd), as this: ->be = (BackEnd)Session;<- But if I try to do the same:...
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
11
by: Vinod | last post by:
Hi, I am working in the project where VC6 code is ported to VC8 (VC++ .Net 2005) I got a problem when I cast a double value to unsigned int. Problem is I couldn’t get the proper value after...
7
by: Ajeet | last post by:
hi I am having some difficulty in casting using generics. These are the classes. public interface IProvider<PROF> where PROF : IProviderProfile { //Some properties/methods }
4
by: Wally Barnes | last post by:
Can someone help a poor C++ programmer that learned the language before there was a standard lib .. etc ? Basically I have two classes that look something like below: template <class T>...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.