|
|
I have custom control which uses a Editor derived from UITypeEditor. In the EditValue method I need a reference to the parent control which exposes a collection. I want to enumerate items in the collection in order to build a dropdown list in the property grid but I have been getting "Unable to cast object of type X to type X" errors when I try to get a reference to the parent control by casting to the parent control type from context.instance. I have seen many articles on the web about this error but no real fix. It appears that the internal versions of the object are somehow different. To cure this problem I am only accessing the parent control via TypeDescriptors. This appears to work but does anyone know how to enumerate a collection using Type/PropertyDescriptors, e.g. can you access the indexer of a collection using a PropertyDescription (i.e. col[1]). If I could do this I could read the contents of the collection OK but I can't see if this is possible.
|
|
|
|
|
class a
{
public void getdata()
{
}
}
class b
{
public void getdata()
{
}
}
main()
{
a aa;
b bb;
bb *ptr;
ptr = &bb;
ptr = &aa;
ptr->getdata();//class a getdata function
}
i was trying to call the function of class a though the object of class b.
can i do this thing using the boxing and unboxing?
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
Sonia Gupta wrote: class a
{
public void getdata()
{
}
}
class b
{
public void getdata()
{
}
}
main()
{
a aa;
b bb;
bb *ptr;
ptr = &bb;
ptr = &aa;
ptr->getdata();//class a getdata function
}
i was trying to call the function of class a though the object of class b.
can i do this thing using the boxing and unboxing?
Boxing and unboxing relates to linking value and reference types. It has nothing to do with pointers and references. I would take a wild guess and say you've been on some C++ sites, or talked to a C++ dev from the code above.
I think you have had a few suggestions from others here and I reiterate : GET A C# BOOK AND READ IT. Your questions are pointless, you never follow up the answers, you NEVER show any appreciation whatsoever. You just post another pointless question.
Please give us the decency of an answer to this question :-
What did you think the code you pasted above would do, or what it means? It doesn't even come anywhere near close to compiling in C#.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
i know , i can't compile this code in c#.For the sake of simplicity , to make othes understand my question/problem , i am showing it up , in this way.If i woulf have done it in c#, i would have never asked it .Don;t u think my friend?
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
Your response makes less sense to me than your question.
You are asking a question that makes no sense to the environment you are in!
You are asking about boxing / unboxing, and showing non C# code , in a C# forum, that attempts to take references and pointers which C# doesn't (easily) do.
It is like me asking somebody on a building forum how to build a house using small angry dogs.
It doesn't make sense.
Forget the code - ask your question in as simplistic terms as you can, and also state WHY you want to know this. Then we can help.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Sonia Gupta wrote: i can't compile this code in c#
Have you tried unsafe blocks?
Sonia Gupta wrote:
i was trying to call the function of class a though the object of class b.can i do this thing using the boxing and unboxing?
You can call a function of class a using an object of class b type if class a is a base class for class b.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
BUY A BOOK !!!!!!!!
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi to all,
I have one string "Ganges: River Of Life" & i want to replace ':' character with space. i have following code but it is not working.
str = "Ganges: River Of Life";
str.Replace(':',' ');
Anybody tell me why this happened?
Pravin
|
|
|
|
|
The reason is that Replace function doesn't modify its parameter, it just returns new string so your code should look like this:
str=str.Replace(':',' ');
|
|
|
|
|
thanks Giorgi Dalakishvili,
code is working now...! thanks again.
Pravin
|
|
|
|
|
Glad to help you
|
|
|
|
|
Is it possible to develop Automatic Number Plate Recognition system in C#? Definetely yes But are there some freeware computer vision libraries to do this? How many time and cost it should be?
Thanks.
|
|
|
|
|
dims12 wrote: Is it possible to develop Automatic Number Plate Recognition system in C#? Definetely yes But are there some freeware computer vision libraries to do this? How many time and cost it should be?
Yes.
Don't know.
The hint is in the name ("freeware").
|
|
|
|
|
hi there
firstly, get this open source control from here:http://www.pixel-technology.com/freeware/tessnet2/
Sample code i wrote for windows form c#: u can figure out the rest
openFileDialog1.ShowDialog();
Bitmap image = new Bitmap(openFileDialog1.FileName);
pictureBox1.Image = image;
tessnet2.Tesseract ocr = new Tesseract();
ocr.SetVariable("tessedit_char_whitelist", txtparameters.Text);
ocr.Init(@".\tessdata\", "eus", false);
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
foreach (tessnet2.Word word in result)
textBox1.Text += word.Text + "\r\n";
|
|
|
|
|
Hello friends
I have a Managed Application, working fine on mine system.
I want to install it on the clients machine .
and the databse is on the server so .
Do i need to make a dsn of it to connect with it.
|
|
|
|
|
w209 wrote: Do i need to make a dsn of it to connect with it.
If your server have a static IP, you can use that
|
|
|
|
|
it does not have a static ip
|
|
|
|
|
AFAIK, it requires a static IP to connect. ALternatively you can create a webservice and map it with a domain name, make your application contact to this webservice, and webservice to your database which is in same server.
|
|
|
|
|
Hi all,
I have a dropdown list on a c# webpage.
The page allows the user to select from a dropdown.
The page allows the user to click on a submit button after selecting.
Once the user selects and presses the dropdown, the system automatically refereshes the page and refereshes the dropdown to default state which doesn't allow me to capture the dropdownllst.SelectedValue.
Kinda frustrating, Any suggestions?
Thanks
|
|
|
|
|
post this in asp.net forum
My small attempt...
|
|
|
|
|
humblepgmr wrote: which doesn't allow me to capture the dropdownllst.SelectedValue.
Is viewstate disabled for your page ? Where you are trying to capture the selected item ?
|
|
|
|
|
hi all,
Is object value type or reference type or can be of both type !!!!
Thanks in advance.
Gaurav
|
|
|
|
|
It's a reference type. Value types are primitive types like int,char
|
|
|
|
|
N a v a n e e t h wrote: Value types are primitive types like int,char
And any user defined struct s.
|
|
|
|