|
He/she certainly is a lightweight. I can't understand why whoever it was univoted Arkiboys for posting a thanks. We get precious few who actually bother to thank for the help that it's a refreshing change when one does - and I always vote them 5 for their manners.
|
|
|
|
|
If you ever decide to go away form VS there is a great application called MSI Factory[^] that I use. It is very good value for money (IMO)
I may or may not be responsible for my own actions
|
|
|
|
|
Hallo
I put several dgv's in a form, and I created a ContextMenuStrip to perform same common operations on dgv's "CurrentRow" record (eg. Deletion).
Is there any way I could reuse the same ContextMenuStrip without duplicating, maybe passing the dgv object as an argument?
I would avoid to rewrite a control that inherits and extends ContextMenuStrip.
Thanks in advance
|
|
|
|
|
LordZoster wrote: maybe passing the dgv object as an argument?
It's passed by default, in the sender-parameter. That's of type object, so you'd have to cast it to a DataGridView .
I are Troll
|
|
|
|
|
Thanks for replying,
actually I get an exception of "casting a ToolStripItem type on DataGridView type".
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
{
DataGridView dgv = (DataGridView)sender;
if (dgv.CurrentRow.Index > -1)
dgv.Rows.Remove(dgv.CurrentRow);
}
modified on Friday, March 18, 2011 6:08 AM
|
|
|
|
|
Solved.
private void eliminaToolStripMenuItem_Click(object sender, EventArgs e)
{
ToolStripDropDownItem menu = (ToolStripDropDownItem)sender;
ContextMenuStrip strip = (ContextMenuStrip)menu.Owner;
Control owner = strip.SourceControl;
DataGridView dgv = (DataGridView)owner;
if (dgv.CurrentRow.Index > -1)
dgv.Rows.Remove(dgv.CurrentRow);
}
|
|
|
|
|
My apologies; it's the ToolStripItem that initiates the action, and that'll be the sender indeed. Thanks for posting the corrected version, always usefull as a future reference
I are Troll
|
|
|
|
|
Hi everybody,
Plz how can I signal that my thread is already answered and have solution
Thank u
modified on Friday, March 18, 2011 8:49 AM
|
|
|
|
|
Just edit it and ad a "[solved]" on the message title. Like I did with this comment
I assume your asking about threads posted here on CP. Not threads as in excecution thread(s).
All the best,
Dan
|
|
|
|
|
To add to MDL=>Moshus' answer, it is also nice if you hit the "Good Answer" button on any answer which helped solve your problem. It can make people more willing to help next time!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Hi,
If the good answer is mine what shall i do?
ty
|
|
|
|
|
Just mark it "solved" as suggested - you can't vote for yourself!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
hi
is it possible to make setup installation for WebService ?
that the installation will make the Virtual directory + the IIS setup + all the Permissions
if it possible, how to do it ?
thank's in advance
|
|
|
|
|
Yes. Use a setup creator such as Wix. There are plenty of tutorials on how to do this scattered around the web.
|
|
|
|
|
What reference assembly I need to add to achieve word automation, a week back sysadmin install office 2010 bundle. Though I do not use C# at my work. and haven't code since last 3 yrs. I am trying to code some internal utilities for team and myself.
TIA
|
|
|
|
|
Microsoft.Office.Interop.Word
* EDIT *
Also: Here is a sample...
using Word = Microsoft.Office.Interop.Word;
Word.Application _wordApp = new Word.ApplicationClass();
object nullObj = System.Reflection.Missing.Value;
object readOnly = true;
object visible = false;
object fileName = "some file name";
object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
Word.Document _doc = _wordApp.Documents.Open(ref fileName, ref nullObj, ref readOnly,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref visible, ref nullObj, ref nullObj, ref nullObj, ref nullObj);
_doc.Activate();
_doc.PrintOut(ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj,
ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj, ref nullObj);
modified on Thursday, March 17, 2011 4:32 PM
|
|
|
|
|
Thanks Tim,
I am missing Microsoft.Office.Interop.Word in MSVC 2005, COM assembly listing.Google did not gave me any good results.
|
|
|
|
|
I'd guess you have to download them. Maybe this Google result[^] helps.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
What's wrong with this????
The date string I'm trying to parse is initially in this format - "date: wed, 16 mar 2011 17:09:37 -0700". I pull off the "date: " portion and remove the comma. That results in "wed 16 mar 2011 17:09:37 -0700".
Here's my code:
string[] words = Line.Split(' ');
string dtstring = words[2].PadLeft(2, '0') + " " + words[3] + " " + words[4] + " " + words[5];
DateTime datetime = DateTime.ParseExact(dtstring, "dd MMM yyyy hh:mm:ss", CultureInfo.InvariantCulture);
I'm getting "String was not recognized as a valid DateTime."
Help!
Everything makes sense in someone's mind
|
|
|
|
|
have you looked at the value of dtstring at all?
please check your words indexes, they seem all wrong.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Yes I have. dtstring contains "16 mar 2011 17:09:37"
Everything makes sense in someone's mind
|
|
|
|
|
there seems to be something inconsistent in your posts.
anyway, two comments:
- maybe, I don't know, ParseExact needs month names in the expected casing (Mar)
- are you aware ":" is not just a colon in DateTime formats, it really means "whatever the separator is for time parts on your system"?
So try with a modified dtstring and/or read the documentation!
ADDED: and then there is HH versus hh of course.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Try HH instead of hh...
DateTime datetime = DateTime.ParseExact(dtstring, "dd MMM yyyy HH:mm:ss", CultureInfo.InvariantCulture);
I may or may not be responsible for my own actions
|
|
|
|
|
VOILA!! That did it
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
So it was a 'Good Answer' then
I may or may not be responsible for my own actions
|
|
|
|