|
The DateTime structure has a Subtract[^] method.
Paul
|
|
|
|
|
TimeSpan timeSpan = [firstDate].Subtract(secondDate);
then you can get the diff like
timeSpan.Minutes;
timeSpan.Hour etc.....
Hope that is what you are looking for
laddie
|
|
|
|
|
Dear All:
I Work With oce 3165 Printer this printer has 4 trays .
i want to work with trays but it is not regular.
(ex:for one print 1,3,2 & another print 1,2,4 used trays)
i work with PrintDocument.printerquerysetting()
but it does not work?
can any one help to me that control on this?
thx
msereshki
-- modified at 1:21 Wednesday 12th September, 2007
|
|
|
|
|
I don't know how to do this via code exactly, but what you can do is install the same printer into Windows 4 times and give them each a different name, although each will point to the same physical printer. For each printer set it to use one of the trays. You could then code against each of these printers - so if you require to use trays 1,3,2 print to Printer 1, Printer 3, Printer 2.
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
in a textbox i want to get only chracters as input, prevent symbols , to do this i tried a fuction which takes the string in the textbox and check it using Char.isletter() and returns true or false.
But i want to know whether there is any other method with String to do this.
|
|
|
|
|
What you're doing is correct. No, there is no method that does the same on an entire string, nor would you want that. By handling the keychanged event and checking char.IsLetter and char.IsControl to set the handled property, you can stop users entering invalid characters in the first place.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi
I am trying to compile a workspace using Msdev.exe (Visual Studio 6) .
I am using the command line and want to redirect the output into a rich textbox on my form.
When an error in compilation occur the process is hanged until i stop my application and only then the Msdev is showing the error.
System.IntPtr PrHndle;<br />
Process Prc = new Process();<br />
<br />
Prc.StartInfo.FileName = VS6EXEPath;<br />
Prc.StartInfo.Arguments = WorkSpace + CompileCommandString;<br />
Prc.StartInfo.UseShellExecute = false;<br />
Prc.StartInfo.RedirectStandardOutput=true;<br />
<br />
Prc.Start();<br />
PrHndle = Prc.Handle;<br />
<br />
StreamReader SR = Prc.StandardOutput;<br />
<br />
while (SR.EndOfStream != true)<br />
{<br />
rtbCmdOutput.Text = rtbCmdOutput.Text + "\r\n" + SR.ReadLine();<br />
}<br />
Prc.WaitForExit();
Same code works good with appliaction.
Please help
Have a nice Day
|
|
|
|
|
Instead of blocking the thread waiting for output, use an event to listen for output:
Process proc = ...;
proc.OutputDataReceived += OutputDataReceivedHandler;
...
void OutputDataReceivedHandler(object sender, System.Diagnostics.DataReceivedEventArgs e)
{
rtbCmdOutput.AppendText(e.Data);
}
|
|
|
|
|
Thanks for the quick answer i will try it and post feedback
Have a nice Day
|
|
|
|
|
Hai everybody,
I am having two radio options in my application.
When i am changing the options a message has to be prompted tot he user and then if the user clicks no then i should not check the next option instead i have to have the first option as selected.
For this i tried the code in the checked change event, but it is not checking the two options
Can any one tell me your suggestions.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
What do you want ? For both radio buttons to be checked ? If you added them together, I'd expect them to form a group, this definately happens if they are on a panel. Then, when one is checked, the other will uncheck. If you want both options to be able to be selected, you should use checkboxes.
If that doesn't help, try posting some code and further explaining what is going wrong.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The options are in the panel.
If one is selected and when the option is changed to false i want to prompt the user and if the user confirms then the option has to be changed or else it should not change to false it has to be true only.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
I think that you will not get any answer because your questions are not clear.
Pawel
|
|
|
|
|
M. J. Jaya Chitra wrote: If one is selected and when the option is changed to false i want to prompt the user and if the user confirms then the option has to be changed or else it should not change to false it has to be true only.
Perhaps you need a DialogResult from your MessageBox something like this:
if (MessageBox.Show("Do You Like Orange", "Choice!", MessageBoxButtons.YesNo) == DialogResult.No)
rdbApple.Checked = true;
________________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
Hi all,
Iam using regular expression to highlight a text. which is even highligting the text if the text is inside any textbox or text areas.
So here is my code pls help me how to get rid of the problem.
Regex re = new Regex("(<[^>]*?.*)("+keywords+"<\\/span>)(.*?>)", RegexOptions.IgnoreCase | RegexOptions.Singleline);
text = re.Replace(text, "$1$2$3") ;
-- key words have one word which has to be highlited --
so now iam trying to remove that span which has already put to those text inside a textbox. this is working fine only when there is only one occurance and not for multiple occurance of the same text.
Smitha
|
|
|
|
|
Smitha,
If you have not figured out your problem yet, please provide more information and I'll see what I can do to help.
Please give an example of the text inside the box, and what is being highlighted. They tell what you expect to happen.
Can you also provide a bit more code as to how you are highlighting the text.
Hogan
|
|
|
|
|
Hi Hogan,
Thanks for your reply,
Basically what am i trying to do is., iam returning few keywords from my backend and if my aspx page has those matching keywords i will highligt those words alone using some class. but the problem is its applying the class for the text inside the textbox also.
Please see the code below.
I have a user control., where i have this code
//this is a c# code
strCode = HighlightKeywords("Hemoglobin", strCode);
here i am calling a method which will return me strCode itself., the strCode will contain a innerhtml of a span and in that span
//This is how my span looks
Alpha-1-fetoprotein Hemoglobin
// now when the HighlightKeywords() method is called, using that method i should highlight that "Hemoglobin" word for the text inside span but not for the text inside my textbox.
so now the code for HighlightKeywords()
private static string HighlightKeywords(string keywords, string text)
{
// Swap out the ,<space> for pipes and add the braces
Regex r = new Regex(@", ?");
keywords = "(" + r.Replace(keywords, @"|") + ")";
// Get ready to replace the keywords
r = new Regex(keywords, RegexOptions.Singleline | RegexOptions.IgnoreCase);
// Do the replace
text = r.Replace(text, new MatchEvaluator(MatchEval));
/*the above code would have replaced the whole span's inner html text where ever Hemoglobin is there it would have replaced using that MatchEval eval method*/
-- now iam see whether there is any textbox if there is a text box then remove that span class='h1' text placed in that textbox.
Regex re = new Regex("(<[^>]*?)"+keywords+"<\\/span>(.*?>)", RegexOptions.IgnoreCase | RegexOptions.Singleline);
text = re.Replace(text, "$1$2$3") ;
return text ;
}
private static string MatchEval(Match match)
{
if (match.Groups[1].Success)
{
return "" + match.ToString() + "";
}
return ""; //no match
}
// its also replacing that "haemoglobin" inside that text box back to haemoglobin. but for only first occurance and not doing for the sencond and third occurance. am i missing anything., i have pasted the whole code. Pls let me know if iam doing something wrong.,
Smitha
|
|
|
|
|
I have been working on an app, and the final revision that the customer wanted was that they want the application to load, and hidden, except for the tray icon. So, I figured OK, easy enough, do a this.Hide(); or a this.Visible = false; upon load. So, it turns out that you cannot do that in the form_load or anywhere at all when the form is starting. I have no way to accomplish this. I found kind of hack-job way to do it. When the form loads, I can set ShowInTaskBar = false, and set the opacity to 0%. However, my project manager would like it done properly, so I am to take the time to find out how it is done. I haven't been able to find any working solutions though. Anyone ever done this, or have any ideas? Thanks!!!
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Set ShowInTaskBar to true and start the form minimized. It will work
|
|
|
|
|
I have been able to do that, and it works. But the customer and my project manager don't want to have the form minizized the user selects to view the form. There has to be a way to actually make the form load without being visible. That's is the only way my project manager will have it.
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
You can make it invisible in the FormShown event and display the notify icon,set up an eventhandler for notify icon click where you show the form. If you want it minimized to tray when user select minimize then handler the resize event and hide the form if its state is minimized.
|
|
|
|
|
Thanks for your assistance, however,I don't see any FormShown event. I am using vs2005. Where are you seeing this event?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
event name is "Shown"
Pawel
|
|
|
|
|
Sorry, it's called Shown
|
|
|
|
|
Giorgi Dalakishvili wrote: Sorry, it's called Shown
It's all good. Thank you. How do I handle this event. Like, where should the event be placed in code, and how can I have this event not show the form?
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|