|
You can't include an existing form that is being displayed inside a OpenFileDialog, but you can extend the OpenFileDialog to include the controls that are inside your form. See here[^] You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Hi i have a question on localisation,
I am trying to change the language/culture of the project without ever opening the project in visiual studio.
Preferably i need to be able to do this by creating some sort of dictionary which can be translated and then create a new resex file.
Does anyone know a way of doing this.
Thanx George
|
|
|
|
|
|
You may need to do some pointer arithmetic and build the array yourself.
Define prefProfile as an IntPtr and increment the pointer by the size of the structure Count - 1 times. On each iteration you can use PointerToStructure to get the IP element.
|
|
|
|
|
Hi there,
I have a function
List<BaseEntity> ConvertList(List<BaseEntity> listBaseEntity)
{
}
Now I am calling the function as follows:
List<ChildEntity> listChild = new List<ChildEntity>();
listChild = ConvertList(listChild);
Here ChildEntity has base class as BaseEntity. On compiling I am getting error as :
Cannot convert type List<ChildEntity> to List<BaseEntity> via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
Then I tried defining the function as
List<object> ConvertList(List<object> listObject)
{
}
Again I am calling the function as follows:
List<ChildEntity> listChild = new List<ChildEntity>();
listChild = ConvertList(listChild);
Then I got the compile time error as
The best overloaded method match for ConvertList(List<object>)' has some invalid arguments
How do I resolve this issue? The list that I am passing to the ConvertList function could be of any type.
Thanks and Regards
-
Sameer
|
|
|
|
|
is the object/list type of your function correct?
listChild = ConvertList(ref listChild);Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi Karsten,
I did the exact way as u'd said but got the following error
The best overloaded method match for ConvertList(List<BaseEntity>) has some invalid arguments.
I'll reconstruct the scenario:
My function definition is as follows:
List<BaseEntity> ConvertList(List<BaseEntity>)
{
}
And I am passing a child object which is inherited from base entity:
List<ChildEntity> listChildEntity = new List<ChildEntity>();
listChildEntity = ConvertList(ref listChildEntity);
Thanks
-
Sameer
|
|
|
|
|
The parameter in the ConvertList function accepts List<baseentity> but when you call the function you parse a ref of listChildEntity... Dollartegn 8D
|
|
|
|
|
Hi Estys,
Thanks for the reply.
Actually the ChildEntity is just one example. The BaseEntity is a base class for many child entities, say ChildEntity1, ChildEntity2, ChildEntity3, etc.
Thus, the list could be of any of these types and certain convert actions need to be taken on the same.
Your solution seems to be great but if you take a look at the replies before, I have tried this and somehow this dint work.
I'll reconstruct the scenario again, in detail.
My ConvertList function belongs to a static class, say ListClassStatic
Thus I am calling the function as:
listChildList = ListClassStatic.ConvertList(ref listChildList);
Thanks and Regards
-
Sameer
|
|
|
|
|
listChild = ConvertList(listChild.ConvertAll<BaseEntity>(delegate (ChildEntity a) { return a as BaseEntity}))
.ConvertAll<ChildEntity>(delegate (BaseEntity a) { return a as ChildEntity});
Each item in List<T> must be cast to the appropriate type and back.
Do you really need to pass a list? It looks horrible
|
|
|
|
|
Hi Estys,
Thanks for the reply. Yeah, I need to pass a list. Can't help it!
Actually the ChildEntity is just one example. The BaseEntity is a base class for May child entities, say, ChildEntity1, ChildEntity2, ChildEntity3, etc.
Thus, the list could be of any of these types and certain convert actions need to be taken on the same.
Your solution seems to be great, but aint it a bit complicated. Is there a simpler one?
Thanks and Regards
-
Sameer
|
|
|
|
|
This works :
static void Conv (BaseEntity baseEntity)
{
baseEntity.id = "b";
}
Invoke like this :
listChild.ForEach(Conv);
It doesn't use a list. Your problem with List<T> is that it won't cast to another type.
|
|
|
|
|
Hi,
We are using Crystal reports 11 (developer version) in our product. I would like to know, how can we handle the localization stuff in crystal reports other than using the third party tools (like "Crystal Translator"
Our application is developed in C# . Here for localization stuff in C#is very simple and we can place all strings in .resx, then the translation is required for only the .rc file according to the language.
Is there any similar functionality/feature is there crystal reports 11 to support for the localization stuff ?.
If you guys through some light on this, it will be very helpful to me.
Thanks
|
|
|
|
|
I have a XML file (foo.xml)that contains about 100 tags. One of the tags looks like this:
"<"CONNECTION HOST ="XYZ"/>
NOTE-no quotation marks before or after the starting less-than sign
Any body has an example on how to extract the XYZ data using C#?
your help is greatly appreciatedmodified on Monday, March 1, 2010 12:22 AM
|
|
|
|
|
That is NOT a well formed XML file, you cannot expect XML to work on crap data, you will need to parse this manually, just like any other text file.
You could read it in and to a replace on "<", then use the xml parser!Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It is well-formatted, it just does not display correctly if I type it the correct way and hence the NOTE-no quotation marks before or after the starting less-than sign
basically it is
OPEN bracket-CONNECTION HOST ="XYZ"/ - close bracket
|
|
|
|
|
We can't see your tag: Try checking this before pasting your XML: Encode "<" (and other HTML) characters when pasting
edit: Damm, my browser cache.
XmlDocument doc = new XmlDocument();
doc.LoadXml("<CONNECTION HOST =\"XYZ\"/>");
XmlElement xml = doc.DocumentElement;
MessageBox.Show("Atribute name: " + xml.Attributes[0].Name + "\r\n Atribute Value: " + xml.Attributes[0].Value);
|
|
|
|
|
Hi,
I'm a newbie and need some help.
How do I go about saving a variable using c# code.
|
|
|
|
|
It depends on the type of the variable and what you mean by 'saving'... to a file, a database, in memory, sharing with another class etc...
|
|
|
|
|
Thanks alot for the reply.
I need to save the variable temporarily for use later.
Thanks in advance for any help you can provide...
|
|
|
|
|
|
I would say hours at the most
|
|
|
|
|
Look into variable SCOPE, assuming you are not talking about saving the value past the end of the current session (stopping the application) a variable is available until it runs out of SCOPE. Do NOT fall into the VB trap of making all your variables global or static. Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi!
I have a problem. I have created a time sheet system that enables a person to enter a start time and an end time. It then calculates the total hours worked.
The problem I have is this:
When a person has been on lunch from say 11:00 to 11:30 and then wants to enter a time worked say 11:15 then an exception should be thrown stating that times cannot overlap. How will I go about checking for this?
Thanks in advance!!Illegal Operation
|
|
|
|
|
two intervals [b1,e1] and [b2,e2] overlap when any of the following is true:
b1<=b2<=e1
b1<=e2<=e1
b2<=b1<=e2
b2<=e1<=e2
So start comparing begin and end DateTimes.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Sunday, February 28, 2010 8:15 PM
|
|
|
|