|
|
Your problem is in usage_minutes. You subtract 60h from h, which gives you a total minutes value of -59 * usage_hours. What you should be doing is something like time_difference.TotalMinutes % 60 (excluding freaky stuff like leap seconds, etc)
|
|
|
|
|
'TotalHours' is not the same to 'Hours';
'TotalMinutes' is not the same to 'Minutes';
//for example
private string DateDiff(DateTime DateTime1, DateTime DateTime2)
{string dateDiff = null;
TimeSpan ts1 = new TimeSpan (DateTime1.Ticks);
TimeSpan ts2 = new TimeSpan (DateTime2.Ticks);
TimeSpan ts = ts1.Subtract(ts2).Duration();
dateDiff = ts.Days.ToString()+"days"+ ts.Hours.ToString()+"hours"+ ts.Minutes.ToString()+"minutes"+ ts.Seconds.ToString()+"seconds";
return dateDiff;
}
modified 27-May-14 5:29am.
|
|
|
|
|
I would like to implement factory methods to transfer data between the gui controls and my dataobjects. The gui controls can be ASP.NET web controls or Windows controls and I have a utility library for each environment. The dataobjects can run in either environment and should know nothing about which it is in.
So what I would like to happen is that when the Web utility library is loaded the webgui<->do bridges are registered and when the Windows utility library is loaded the wingui<->do bridges are registered. That way the dataobjects can send/receive data from the gui without knowing which gui it is.
It seems like such a basic requirements for factories. Is there a way to do this?
|
|
|
|
|
Maybe have a look here[^]
"Inversion of Control containers allow you to achieve loosely coupled designs and they handle dependency and configuration management when you, or a class in your system, request a service to say, send e-mails, you will get an instance ready to be used."
only two letters away from being an asset
|
|
|
|
|
I have a third party library which i have added to the skip verification list, using sn, on my computer.
I wanted to know whether the application (after deploying it on some other computer) will run?
Do i have to perform some other tasks after the deployment (setup)?
|
|
|
|
|
Yes it will work ,
SN protected the Application Exe bytes from begin modify.
I know nothing , I know nothing ...
|
|
|
|
|
Hi,
I'm trying to use ExportAsFixedFormat with a Visio Document. I'm using Office 2007 and Visual studio 2008.
Here is my code:
ApplicationClass visioApplication = new ApplicationClass();
Document visioDocument = visioApplication.Documents.Open(@"C:\temp.vsd");
visioDocument.ExportAsFixedFormat(VisFixedFormatTypes.visFixedFormatPDF,
@"c:\visio.pdf", VisDocExIntent.visDocExIntentPrint,
VisPrintOutRange.visPrintAll, 0, 0, false, true, true, true, false, null);
I've been trying different values for the bools and enums, but with no
success. All I get is a COMException telling me "Invalid parameter".
Any suggestions?
Thanks in advance.
|
|
|
|
|
/* for example to open a word;
key codes */
try
{ // Open the source document. wordDocument = wordApplication.Documents.Open( ref paramSourceDocPath, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing, ref paramMissing); // Export it in the specified format. if (wordDocument != null) wordDocument.ExportAsFixedFormat(paramExportFilePath, paramExportFormat, paramOpenAfterExport, paramExportOptimizeFor, paramExportRange, paramStartPage, paramEndPage, paramExportItem, paramIncludeDocProps, paramKeepIRM, paramCreateBookmarks, paramDocStructureTags, paramBitmapMissingFonts, paramUseISO19005_1, ref paramMissing);}catch (Exception ex){ // Respond to the error}finally{ // Close and release the Document object. if (wordDocument != null) { wordDocument.Close(ref paramMissing, ref paramMissing, ref paramMissing); wordDocument = null; } // Quit Word and release the object. if (wordApplication != null) { wordApplication.Quit(ref paramMissing, ref paramMissing, ref paramMissing); wordApplication = null; } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers();}
modified 27-May-14 5:30am.
|
|
|
|
|
Thanks for your reply.
ExportAsFixedFormat function is working for word documents.
Problem is with Visio document.
Please provide the solution for the conversion of visio to pdf document.
|
|
|
|
|
Its not working in C#.net, but working in VB.net
So I created the dll and used in my application.
doc.ExportAsFixedFormat(Visio.VisFixedFormatTypes.visFixedFormatPDF, "C:\test.pdf", Visio.VisDocExIntent.visDocExIntentPrint, Visio.VisPrintOutRange.visPrintAll)
Thanks for the support
|
|
|
|
|
Hi,
This is my string "Product : tempuri"
i want to search "Product :" and want to save the value of the next word in a group.
please tell me the regex.
|
|
|
|
|
|
karmjit435 wrote:
i want to search "Product :" and want to save the value of the next word in a group.
You can do this without using regex. A possible solution could be (just an example):
string str = "Product : tempuri";
string strProduct = str.Substring(str.IndexOf(":") + 1);
Regards
Nuri Ismail
|
|
|
|
|
karmjit435 wrote: please tell me the regex.
What have you tried already? HAve you looked at any documentation for regex? Do you just want some hardworking person here to provide you the answer? Do they therefore get your paycheck for this piece of work?
Many questions, not many answers.
|
|
|
|
|
ok.. your point is right..
i was expecting this kind of reply..
i have string
String s = "this is Product : temp org is fine";
can you tell me how can can get "temp" only in my value group.
here is what i tried
Regex productRegex = new Regex(@"(Product) *(:b)* b)*(?<value> .+) ");
|
|
|
|
|
Whats wrong with simply:
Product : (?<value>[a-zA-Z]+)
Assuming only alpha characters after the : that should work just fine
modified on Thursday, September 10, 2009 10:33 AM
|
|
|
|
|
You don't need that question mark; I'd use Product\s*:\s*(\w+)
|
|
|
|
|
the ? was the start of a named group <value> - I just forgot to escape the angle brackets
|
|
|
|
|
Ah, I use apostrophes for that instead: (?'value'\w+) At least it helps in these cases.
|
|
|
|
|
Hi,
Thanks that resolved my problem.
Regards,
KS
|
|
|
|
|
there is another problem
i have string Product : temp product name \<br\>
i have to extract the string after : and before \<br\>
KS
|
|
|
|
|
i have string
String s = "this is Product : temp org is fine";
can you tell me how can can get "temp" only in my value group.
here is what i tried
Regex productRegex = new Regex(@"(Product) *(:b)* b)*(?<value> .+) ");
can you tell me.. there can some error while posting the message
after ? there is <value> group.
|
|
|
|
|
0) You probably want \w , not .
1) What is :b supposed to be?
2) Why are you putting the things you don't want in groups?
3) Product\s*:\s*(?'value'\w+)
4) Look into Expresso[^]
|
|
|
|
|
i want more buttons on the messagebox in c#. not only ok,cance,yes,no......
i want refresh,print..... on the messagebox. how to write code
|
|
|
|