Click here to Skip to main content
15,895,799 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to Connect to Dominos server from MS Outlook?? Pin
Daniele Ferrero3-May-06 4:20
Daniele Ferrero3-May-06 4:20 
QuestionHow to call a Page as an object in a method?? Pin
ryanchopps3-May-06 0:39
ryanchopps3-May-06 0:39 
AnswerRe: How to call a Page as an object in a method?? Pin
alexey N3-May-06 0:45
alexey N3-May-06 0:45 
GeneralRe: How to call a Page as an object in a method?? Pin
ryanchopps3-May-06 3:32
ryanchopps3-May-06 3:32 
QuestionHow to handle the mouse pointer using c# Pin
ranandbe3-May-06 0:06
ranandbe3-May-06 0:06 
AnswerRe: How to handle the mouse pointer using c# Pin
alexey N3-May-06 0:31
alexey N3-May-06 0:31 
AnswerRe: How to handle the mouse pointer using c# Pin
ranandbe3-May-06 0:37
ranandbe3-May-06 0:37 
QuestionHow to attach context menu to array of controls? Pin
Kranti12519842-May-06 23:30
Kranti12519842-May-06 23:30 
Hi,

I'm writing an application in c#.net, in which i've created array of control Button. I want to display a menu when user clicks any of the buttons in the array.

I was able to create context menu for a single button, but not for the array, as coded below ...

<br />
<br />
public class ButtonArray : System.Collections.CollectionBase<br />
{<br />
	private readonly System.Windows.Forms.Form ContainerControl;<br />
	public ButtonArray(System.Windows.Forms.Form Cont)<br />
	{<br />
		ContainerControl = Cont;<br />
	}<br />
	public void AddButton()<br />
	{<br />
		//code to create button  <br />
		btButton.MouseDown += new MouseEventHandler(btButton_MouseDown); <br />
	}<br />
	public void btButton_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)<br />
	{<br />
		contextMenuStudInfo = new System.Windows.Forms.ContextMenu();<br />
<br />
		System.Windows.Forms.MenuItem menuItem1;<br />
		menuItem1 = new System.Windows.Forms.MenuItem();<br />
		System.Windows.Forms.MenuItem menuItem2;<br />
		menuItem2 = new System.Windows.Forms.MenuItem();<br />
		contextMenuStudInfo.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { 					menuItem1, menuItem2 });<br />
<br />
		menuItem1.Index = 0;<br />
		menuItem1.Text = "Mark Present";<br />
		menuItem2.Index = 1;<br />
		menuItem2.Text = "Mark Absent";<br />
		<br />
		this.btButton.ContextMenu = contextMenuStudInfo;<br />
	}<br />
}                                <br />


how to attach the context menu to each member of button control array?

Thanks,
Kranti

-- modified at 5:31 Wednesday 3rd May, 2006
QuestionHow to get font from a winForm control of another application? Pin
snowborderjiang2-May-06 23:23
snowborderjiang2-May-06 23:23 
AnswerRe: How to get font from a winForm control of another application? Pin
alexey N2-May-06 23:28
alexey N2-May-06 23:28 
GeneralRe: How to get font from a winForm control of another application? Pin
snowborderjiang3-May-06 16:37
snowborderjiang3-May-06 16:37 
QuestionFile Hiding Pin
Prashant Gadhave2-May-06 23:23
Prashant Gadhave2-May-06 23:23 
AnswerRe: File Hiding Pin
J4amieC3-May-06 0:16
J4amieC3-May-06 0:16 
GeneralRe: File Hiding Pin
Travis D. Mathison3-May-06 3:03
Travis D. Mathison3-May-06 3:03 
QuestionReources Pin
V.2-May-06 22:12
professionalV.2-May-06 22:12 
AnswerRe: Reources Pin
Travis D. Mathison3-May-06 2:44
Travis D. Mathison3-May-06 2:44 
GeneralRe: Reources Pin
V.3-May-06 3:29
professionalV.3-May-06 3:29 
GeneralRe: Reources Pin
Travis D. Mathison3-May-06 3:45
Travis D. Mathison3-May-06 3:45 
GeneralRe: Reources Pin
V.3-May-06 3:58
professionalV.3-May-06 3:58 
QuestionASPNET or NETWORK SERVICE Pin
Andrey.Mazoulnitsyn2-May-06 21:59
Andrey.Mazoulnitsyn2-May-06 21:59 
QuestionProblem using Crystal Report in C# Pin
Naveed N Malik2-May-06 21:40
Naveed N Malik2-May-06 21:40 
QuestionError Pin
Hamid_RT2-May-06 20:46
Hamid_RT2-May-06 20:46 
GeneralRe: Error Pin
Guffa2-May-06 21:23
Guffa2-May-06 21:23 
GeneralRe: Error Pin
Hamid_RT2-May-06 21:42
Hamid_RT2-May-06 21:42 
AnswerRe: Error Pin
Travis D. Mathison3-May-06 2:21
Travis D. Mathison3-May-06 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.