|
Hi,
I'm trying to build a dll that makes automated changes to powerpoint presentations. I want to go through each slide and change all instances of an automatically generated date/time to one that I will provide. I'm having trouble finding in in the object model, however. I've gotten all the way to the slide.shape.textframe how can I check to see if what is in the frame is an automatically generated date/time?
I was thinking maybe text fields store a collection of objects taht aren't necessarily text and I could test against a dateAndTime object or something, but it looks like this is not the case.
Any Suggestions?
|
|
|
|
|
hi every body
i want know how can i get the path of the folder which the program start from it after install
example
the default directory for any program is :
c:\program files\*****\****
but user may change this path to any another path
my question is how can i get this path
i have tried (Environment.CurrentDirectory);
but it didn`t work
it returned by (My documents path)
any body can help me ??
|
|
|
|
|
Application.StartupPath works under most situations.
Environment.CurrentDirectory only gets the current working directory - nothing to do with the application itself.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
thank you davey it`s worked with me
|
|
|
|
|
hi,
i want to use my java classes in c# application.I used IKVm tool which will convert java class files to dll.But my one of the class is giving me error when i am using it.Error occurs when i create object of that class and in that class there is one more class called.And it will give me error that class not found.i also included the reference for that second class in my C# project.
If anybody can help me that will be great.
Thanks in advance.
From,
Monika.
|
|
|
|
|
Hallo all, I'm using c# to load an rtf file in a richTextBox but I have a problem when the file includes table of contents (TOC). The TOC appears as plain text, while in ms word it has blue fore color, and if you press it (in ms word "control button and click") it does not respond at all.
Is there a way to use the TOC in richTextBox??
Thanks!!
|
|
|
|
|
Nope. Not supported. RichTextBox does not contain a complete implementation of RTF. Also, Word offers features that you don't find in the RTF specification.
|
|
|
|
|
I am trying to translate some extended characters back into a more "English" representation, so that users can more easily search for the strings in a database.
For example, the singer "Beyoncé" has a "e" with a symbol over it and we use this representation for the display name. This symbol can be entered by typing alt+130 on the numeric keypad. However, we also want to store the "normal" version of the string ("beyonce") in a second field, so that we can search for it without having to jump through hoops. We want to automatically generate the search name based on the text in the display name field.
I've tried messing around with string replacements, lookup tables and other esoteric mechanisms, but nothing seems to work consistently. I'm now thinking I need to start looking at code pages and different encoding mechanisms, but the documentation on this is so terrible, it's difficult to know where to begin.
Does anyone know of a reliable, platform-independet method to remove these extended characters and replace them with a suitable English equivalent? Additionally, is there a better way of entering these characters, other than the alt+numpad mechanism, which also seems to change depending on code pages and other witchcraft.
eg:
Beyoncé --> beyonce
Mötley Crüe --> motley crue
Thanks!
|
|
|
|
|
I have some functions i am trying to compare for speed and want to run many iterations of them. I can see in the future that i could need to do the same thing again so i want to build a generic testing class.
My idea would be to write something like:
mainFunction
{
functionsToTest = (funk1, funk2, funkN)
foreach functionsToTest
for "itterations"
call function
}
The issue i run into is that i would need to pass a function as a parameter to one of the functions in my class. I know this can be done in C++ so i assume there has to be some way to do this in C#.
My question is how can i pass a function as a parameter? It would also be cool if i could put references to functions in a List<>, but I'll take the moon before the stars.
|
|
|
|
|
You could use a delegate in .NET 2.0 or a Lambda expression if you're using .NET 3.5.
|
|
|
|
|
Hi folks! I've coded myself into another corner... again! I need a guru.
This time, I'm writing code that checks that the parameter list for a call to a method is valid. Why? Because I am dynamically calling various methods with parameters read from an XML file. Why? Don't ask... looooong story.
Breifly, a call to my routine might look like
StandardTest.PerformDALvsDBTest(
"DALRoutines",
"InsertCustomer",
new object[] {
DateTime.Parse(parm0),
parm1,
Int32.Parse(parm2)
}
);
Okay. So my routine goes through a bunch of checks and finally obtains a reference to the method to be called (MethodInfo.methodRef ). The call to the method will be made using
methodRef.Invoke(null, myBindings, null, Params, null);
But first, I must make sure that all the items in the object[] Params are of the right type. To do that I loop through methodRef.GetParameters() and check each one against each Params[index].GetType() .
If there are the correct number of parameters, and they are all of the correct type, etc, then I will perform the Invoke() , otherwise, I throw an error indicating the method name, the parameter, the expected type and the type that was used:
e.g. "The System.Type for parameter #0 in the parameter list for the method [DALRoutines.InsertCustomer] is System.DateTime; System.TimeSpan was expected".
So, here is my problem:
I have a method that expects a parameter to be an Int32 . However, when the value is passed in the object[] Params , it seems to be changed to Int16 (even if I specifically indicate that it is Int32 as above - I assume that it is because it is a small value). When my routine starts comparing parameter types it spits out an error saying it was passed an Int16 when it expects an Int32 . The kicker is that the call to Invoke() would still work if it was made - .NET does not seem to mind and handles the conversion inherently. But I can't find a way to tell that it would work - all I can see is that the two types are different.
I have tried investigating different ways to tell if the types are compatible (including Type.IsSubclassOf() and Type.IsAssignableFrom() ) but I can't seem to find anything that will let me know that an Int16 can be used as the value for an Int32 parameter.
Does anyone know a way to do this?
Clive Pottinger
Victoria, BC
|
|
|
|
|
You could always try to perform a cast on it. It's not the most efficient method, but I figure that's not what you're worried about - what with the reflection and all.
|
|
|
|
|
Would something like this be okay?
public static bool ImplicitCastAllowed(Type type, object value)
{
try
{
Convert.ChangeType(value, type);
return true;
}
catch
{
return false;
}
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks guys - but I found the cause of the problem... P.E.B.K.A.C.!
I was actually rewriting the routine to use Convert() (thanks Greeeg), when I noticed that I my error message was printing out the wrong info - instead of saying that the parm was "of type passedParmType; requiredParmType was expected", it said it was of "type requiredParmType; passedParmType was expected"!
That led to finding other places where I had mixed up the two references (due to an ambiguous naming convention). Once I fixed that I found that my code was actually working correctly and warning me that I was trying to use an Int32 as a value to an Int16 parameter.
Perhaps I should consider a change of career. I hear that Air Traffic Control is less stressful... and apparently the FAA is much more lenient about minor errors than IT managers.
Clive Pottinger
Victoria, BC
|
|
|
|
|
I have managed to customize the error message if a valid integer is not input for the propertyGrid field. But how can i display the old values (whatever was entered) because after putting an invalid Integer i see "0" in the propertyGrid field. I guess it's because i am sending a null.
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
object obj = null;
try
{
obj = base.ConvertFrom(context, culture, value);
}
catch (Exception e)
{
if (_hasShownErrorMsg==false)
{
_hasShownErrorMsg = true;
MessageBox.Show("not a valid number.");
}
}
_hasShownErrorMsg = false;
return obj;
}
|
|
|
|
|
after validating a value, store it somewhere:
try
{
obj = base.ConvertFrom(context, culture, value);
lastValidValue = value;
}
...
then then next time around if the call to base.ConvertFrom throws an exception you can restore to lastValidValue
|
|
|
|
|
hello friends,
how can i make a simple, soft and nice brush like that is in the microsoft paint?
My solution was to draw consecutive circles in my mouse drag event and add them to the array list and then repaint all circles in the array list. but some of the events of mouse drag are missed and this make my brush dotted. i want to know how can i make it more smooth. please guide me.
thanks
modified on Wednesday, September 17, 2008 1:41 PM
|
|
|
|
|
Sajjad Izadi wrote: My solution was to draw consecutive circles in my mouse drag event and add them to the array list and then repaint all circles in the array list.
Seems you will also need to join the circles to get an smooth effect.
Regards,
Syed Mehroz Alam
|
|
|
|
|
yes yes, that's it. but the way to solve...?
|
|
|
|
|
your in the wrong forum, try graphics
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Harvey Saayman wrote: 1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
Yes, it does. But you spelled "I'm" as "im"...
44 6F 20 79 6F 75 20 72 65 61 64 20 68 65 78 20 61 6C 73 6F 3F
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: 44 6F 20 79 6F 75 20 72 65 61 64 20 68 65 78 20 61 6C 73 6F 3F
apparently i can octal too if i really have to
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
i have a string that always is 6 chars long. If it is not then zeros are added to it. I am pullinging this info out of the database and i need to add 1 to it.
Example:
I get "000456" and need to add 1 to it so its "000457"
Is there an easy way to do that?
|
|
|
|
|
Yes, try this:
string s = "000456";
int i = -1;
if (Int32.TryParse(s, out i))
{
i +=1;
s = String.Format("{0:000000}", i);
} This takes your string and tries to convert it to an integer value. If that succeeds, it adds 1 to it and then formats it back as a string to 6 characters padded with zeroes.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Another way:
<br />
int Intvalue = Convert.ToInt32("000456") + 1;<br />
string Stringvalue = Intvalue.ToString("000000");
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|