|
I have a datagridview. I want to allow users to right click on any record. When they right-click, they will get options like Add/Delete...etc.
Can you provide a sample code or external link to an example in c#?
|
|
|
|
|
Hi,
In order to achive the desired behavior you need to add ContextMenuStrip on the form. Then you need to add the MenuItems for the context menu and write code for the respective MenuItem (i.e., for Delete or ADD). Then you can attach the ContextMenuStrip to your grid on FormLoad (or any other event as per your requirement) in the following manner:
BEGIN CODE
this.dataGridView1.ContextMenuStrip=this.contextMenuStrip1
END CODE
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
have a textbox and in that i want to disable copy paste option of the user in window application using vb.net. Please let me know the solution
|
|
|
|
|
You will need to handle keyboard events such as KeyDown/KeyUp and/or KeyPress. In the event handlers check if ctrl+v or ctrl+c is pressed. You will also need to make sure that user can't open context menu of the textbox.
Giorgi Dalakishvili
#region signature
my articles
#endregion
modified on Monday, March 24, 2008 3:37 AM
|
|
|
|
|
Hi,
I have a MDI application and I want to get the child form which is currently in focus/on top/being used.
I've tried using logic like this to loop through all the MDIChildren:
<br />
array<system::windows::forms::form^>^ children = this->MdiChildren;<br />
for each (System::Windows::Forms::Form^ form in children){<br />
if(form->TopMost){<br />
System::Windows::Forms::MessageBox::Show(form->Text->ToString());<br />
}<br />
}<br />
</system::windows::forms::form^>
but it doesn't work.
|
|
|
|
|
I guess you should access the form's Active proprety
|
|
|
|
|
What you're looking for is the ActiveMdiChild[^] property of your MDI parent form.
|
|
|
|
|
Hi,
I have to run a C# windows service in .net in which i have to generate popup message box reminder every one hour. i dont want to run it as a application, as each and every time we have to run it manually daily. i cant find a message box in windows service. can anybody please give me an idea of how to do it in an automatic service so that no manual process should be done. once they switch on the system, the service should start automatically and should generate popups once an hour. Pls help.
Thanks and Regards
Vijayarajan.V
|
|
|
|
|
Erhm, too bad... You have to find another solution... A Windows Service does not support a GUI. You may want to develop a diffrent application which does support GUI (WinForms app.) and start start using the Process.Start() method from your service.
|
|
|
|
|
Maybe, just maybe, you can program something like a NET SEND command ? That shows 'like' a messagebox.
|
|
|
|
|
Hi All,
I have an winform control which needs to be hosted in a aspx page. Iam using the <object> tag do so and its working. When an event occuers (like tab click) on the IE hosted winform control i need to raise this event to the aspx page which hosted the control.
Any sort of help is appriciated. Thanks in advance.
Regards
Pani.
|
|
|
|
|
Kodanda Pani wrote: i need to raise this event to the aspx page which hosted the control.
I don't think this is possible.
|
|
|
|
|
Why on earth are you using this architecture? It's just plain daft.
If you need a control, you should write it as an ASP.NET control - they are very easy to write - and more importantly they sit neatly in the whole HTTP pipeline, so they can easily raise events that the host can interact with.
|
|
|
|
|
I am trying to get the position of the scoll bar in a rich text box.
I am calling the following method:
[DllImport("user32")] public static extern int GetScrollPos(IntPtr hwnd, int nBar) ;
Like this:
public const int SB_VERT = 1;
int pos = GetScrollPos(rtb.Handle, SB_VERT);
where rtb is a RichTextBox
If the form containing the rich text box does not have focus, this gives me the scroll position accurately. If the form does have focus, it gives me an inaccurate result. For example, if I scroll to the top of the rtb, and the form does not have focus, this returns 0.
But if the form has focus, this always returns a value which indicates the rtb is scrolled to the bottom (regardless of where the scroll actually is).
Anyone know why this happens, or how to work around it?
Thanks
|
|
|
|
|
hello every body
iam looking for J# statement equivlant to this C# one
datagridview1[j,i].Value
where j,i are the row and coulmn indexes
thanks in advance
|
|
|
|
|
mr.me wrote: iam looking for J# statement equivlant to this C# one
You are looking for it?
Get a beginners book or take a university course.
led mike
|
|
|
|
|
You do know that J# is a dead product, right? MS will support it until 2015(?), but there will be no further development on the language and you won't see it in future versions of the .NET Framework or Visual Studio.
|
|
|
|
|
Dave Kreskowiak wrote: do know that J# is a dead product
Yep, and never even bothered to look at it
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi,
AFAIK Java uses the array-of-array notation, as in arr[i][j] .
And IIRC they don't have indexers nor properties: in your statement, datagridview1
is presumably a DGV, not an array, but the indexer capabilities of C# allow you
to access its internal data as if the object itself were an array.
And properties represent code (a getter and/or setter method) that shows up as if
it were a data member.
So in the end you may well end up writing something like datagridview1.GetValue(i,j)
for a class that then needs to have a GetValue() method.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Dear all,
Here iam working on windows based application.
Requirement:
Under one button click i need search all the drives(Folders under drives also) for a file type(eg;.jpg,.mp3)
Can you please help me out with some code. or some
Proper way to approach. Its very urgent please....
Thanks in advance.
suresh.
Sursh
|
|
|
|
|
premsuri wrote: Its very urgent please....
It's always urgent. Oh wait, you've got for full stops. That makes all the difference.
Write a recursive function to walk the directory structure - it's not hard.
|
|
|
|
|
and of course that recursive function looks like :
<br />
private void LoopFolders(DirectoryInfo myFolder)<br />
{<br />
if ((myFolder != null) && (myFolder.Exists))<br />
{<br />
foreach (DirectoryInfo mySubFolder in myFolder.GetDirectories())<br />
{<br />
Console.WriteLine(mySubFolder.Name);<br />
LoopFolders(mySubFolder);<br />
}<br />
}<br />
}<br />
in case you didn't figure that out yet
|
|
|
|
|
I have created a computer program that the user will download. Is there anyway to make money off of the program without charging for the program (advertising, etc).
Thanks!
|
|
|
|
|
Not really, no. Advertising doesn't pay much and users hate it. Unless you wrote the next Napster ( in terms of being something everyone will want ), I'd say forget it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
They could download the app free but pay you for source.
|
|
|
|